Commit Graph

244 Commits

Author SHA1 Message Date
Daniel Pyrathon fb48eb0581 Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of
Code 2014 project and everyone else who helped with the patch!
2015-01-06 19:25:12 -05:00
Daniel Pyrathon 8958170755 Fixed #9104 -- Moved FieldDoesNotExist to core.exceptions 2015-01-02 10:46:04 -05:00
Anssi Kääriäinen f233bf47dd Fixed #21414 -- Removed RelatedObject and deprecated Field.related. 2014-12-23 10:54:25 -05:00
Anssi Kääriäinen 1c5cbf5e5d Fixed #24002 -- GenericRelation filtering targets related model's pk
Previously Publisher.objects.filter(book=val) would target
book.object_id if book is a GenericRelation. This is inconsistent to
filtering over reverse foreign key relations, where the target is the
related model's primary key.
2014-12-17 10:04:52 +02:00
Markus Holtermann aa5ef0d4fc Fixed #23822 -- Added support for serializing model managers in migration
Thanks to Shai Berger, Loïc Bistuer, Simon Charette, Andrew Godwin,
Tim Graham, Carl Meyer, and others for their review and input.
2014-12-15 08:34:15 -05:00
Jon Dufresne 4468c08d70 Fixed #23968 -- Replaced list comprehension with generators and dict comprehension 2014-12-08 07:58:23 -05:00
wrwrwr dd35cc232a Fixed #23641 -- Moved post_migrate signals for contrib apps to AppConfig.ready(). 2014-11-27 13:06:35 -05:00
Josh Smeaton f59fd15c49 Fixed #14030 -- Allowed annotations to accept all expressions 2014-11-15 14:00:43 +00:00
averybigant b7a5b6ab86 Fixed #23750 -- Allowed core.checks.register to be used as a function 2014-11-11 16:29:32 +01:00
Berker Peksag c9178ef17a Limited lines to 119 characters in django/{contrib,db}.
Refs #23395.
2014-10-29 07:59:35 -04:00
Loic Bistuer ed37f7e979 Fixed #23611 -- update_or_create failing from a related manager
Added update_or_create to RelatedManager, ManyRelatedManager and
GenericRelatedObjectManager.
Added missing get_or_create to GenericRelatedObjectManager.
2014-10-08 03:27:31 +07:00
Tim Graham 32c7d3c061 Fixed #15089 -- Allowed contrib.sites to lookup the current site based on request.get_host().
Thanks Claude Paroz, Riccardo Magliocchetti, and Damian Moore
for contributions to the patch.
2014-10-01 16:23:20 -04:00
Claude Paroz d6a15026c4 Updated translations from Transifex
Forward port of e9c8aefbce from stable/1.7.x
2014-09-30 20:55:50 +02:00
Justin Caratzas cf43a1ee90 Fixed #23539 -- Added get_extra(), get_max_num(), and get_min_num() hooks to GenericInlineModelAdmin. 2014-09-24 06:32:42 -04:00
Andrew Godwin 7a259008a7 Fixed #22411: Throw a more helpful error if contenttypes doesn't exist. 2014-09-05 11:59:56 -07:00
Tim Graham 1101467ce0 Limited lines to 119 characters in django/
refs #23395.
2014-09-05 09:22:16 -04:00
Claude Paroz efa67b897b Fetched translations from Transifex
Forward port of 49280a73ea from stable/1.7.x
2014-08-20 10:22:41 +02:00
Jacob Haslehurst f676305ece Fixed #22982 -- Added GenericRelatedObjectManager.__str__. to prevent crash.
Thanks bendavis78 for the report.

Forwardport of 29585e9b6a from stable/1.7.x
2014-08-07 14:44:20 -04:00
Mitar 1ed6fbcf44 Fixed #21940 -- Added kwargs to contribute_to_class() of model fields..
Thanks Kronuz for the suggestion.
2014-08-01 07:41:28 -04:00
Nick Sandford fa3cf006b2 Fixed #23078 -- Regression in update_contenttypes() interactivity.
Thanks raymond at adaptiv.nl for the report.
2014-07-23 08:45:09 -04:00
Tim Graham eb8600a656 Added database migration for contrib.contenttypes.
Moved contenttypes tests to allow them to run correctly in the presence of
migrations. refs #22170.
2014-06-16 15:03:00 -04:00
Anubhav Joshi 5643a3b51b Fixed #10811 -- Made assigning unsaved objects to FK, O2O, and GFK raise ValueError.
This prevents silent data loss.

Thanks Aymeric Augustin for the initial patch and Loic Bistuer for the review.
2014-06-05 13:12:01 -04:00
Antonis Christofides 62f9508ade Fixed #20401 -- ContentTypeManager.get_for_model reads from db_for_read.
Thanks Simon Charette and Tim Graham for the reviews.
2014-05-29 23:01:55 +07:00
Claude Paroz 1a69d276bd Updated translation catalogs 2014-05-19 15:17:35 +02:00
Anders Steinlein 4ef10f245a Fixed #17642 -- Added min_num support to modelformsets, inlines, and the admin.
Thanks Stephen Burrows for work on the patch as well.

Forwardport of 2914f66983 from stable/1.7.x
2014-05-15 07:25:35 -04:00
Tim Graham b513fa5fc6 Fixed #22195 -- Used constants to define built-in tags for check framework.
Thanks Elvard for the patch.
2014-04-10 08:45:48 -04:00
Loic Bistuer 20399083f4 Fixed #19816 -- Pre-evaluate querysets used in direct relation assignments.
Since assignments on M2M or reverse FK descriptors is composed of a `clear()`,
followed by an `add()`, `clear()` could potentially affect the value of the
assigned queryset before the `add()` step; pre-evaluating it solves the problem.

This patch fixes the issue for ForeignRelatedObjectsDescriptor,
ManyRelatedObjectsDescriptor, and ReverseGenericRelatedObjectsDescriptor.
It completes 6cb6e1 which addressed ReverseManyRelatedObjectsDescriptor.
2014-03-30 15:36:45 +07:00
Loic Bistuer bc9be72bdc Fixed transaction handling for a number of operations on related objects.
Thanks Anssi and Aymeric for the reviews. Refs #21174.
2014-03-30 12:13:00 +07:00
Aymeric Augustin 0f9560855e Removed legacy transaction management per the deprecation timeline. 2014-03-21 21:06:50 +01:00
Tim Graham bcc15e2b21 Removed backward compatible shims to rename get_query_set and similar queryset methods.
Also removed the backward compatible shims introduced to rename the
attributes ChangeList.root_query_set and ChangeList.query_set.
2014-03-21 07:47:25 -04:00
Claude Paroz 210d0489c5 Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings
Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
2014-03-08 09:57:40 +01:00
Russell Keith-Magee 70ec4d776e Fixed #22034 -- Added a specific set of relation checks for GenericInlineModelAdmin.
Thanks to jwa for the report.
2014-03-08 11:25:23 +08:00
James Jenkins ec675ed6cc Fixed #22070 -- Changed verbose_name for apps in django.contrib to use title case
Thanks bendavis78 for the report.
2014-03-06 18:43:04 -05:00
Gabe Jackson b77f26313c Fixed #22207 -- Added support for GenericRelation reverse lookups
GenericRelation now supports an optional related_query_name argument.
Setting related_query_name adds a relation from the related object back to
the content type for filtering, ordering and other query operations.

Thanks to Loic Bistuer for spotting a couple of important issues in
his review.
2014-03-05 22:37:53 +02:00
Thomas Sorrel 53c576452e Fixed #16727 -- Added protocol-relative URL support to contenttypes.views.shortcut. 2014-03-03 22:57:06 +01:00
Russell Keith-Magee bc4dc6e99c Edited model check messages for grammar and consistency. 2014-03-03 15:35:42 +08:00
Russell Keith-Magee 57e08aa232 Cleanup of contrib.contenttypes check messages. 2014-03-03 14:19:06 +08:00
Aymeric Augustin f9698c4391 Suppressed the `if Site._meta.installed` pattern.
The purpose of this construct is to test if the django.contrib.sites
application is installed. But in Django 1.9 it will be forbidden to
import the Site model when the django.contrib.sites application isn't
installed.

No model besides Site used this pattern.

Refs #21719, #21923.
2014-02-01 20:38:15 +01:00
Simon Charette 10e3faf191 Fixed #19774 -- Deprecated the contenttypes.generic module.
It contained models, forms and admin objects causing undesirable
import side effects. Refs #16368.

Thanks to Ramiro, Carl and Loïc for the review.
2014-01-26 14:42:30 -05:00
Aymeric Augustin 9ffab9cee1 Moved RequestSite and get_current_site.
Following the app-loading refactor, these objects must live outside of
django.contrib.sites.models because they must be available without
importing the django.contrib.sites.models module when
django.contrib.sites isn't installed.

Refs #21680. Thanks Carl and Loic for reporting this issue.
2014-01-26 08:50:47 +01:00
Aymeric Augustin 2ff93e027c Fixed #21829 -- Added default AppConfigs.
Thanks Russell for the report, Marc for the initial patch, Carl for the
final review, and everyone who contributed to the design discussion.
2014-01-25 10:41:56 +01:00
Anssi Kääriäinen 6ab58e3605 Fixed a couple of deprecation warnings 2014-01-20 13:12:15 +02:00
Alex Gaynor be8173af51 Fixed a small collection of flake8 violations that had snuck in 2014-01-19 21:15:31 -06:00
Russell Keith-Magee d818e0c9b2 Fixed #16905 -- Added extensible checks (nee validation) framework
This is the result of Christopher Medrela's 2013 Summer of Code project.

Thanks also to Preston Holmes, Tim Graham, Anssi Kääriäinen, Florian
Apolloner, and Alex Gaynor for review notes along the way.

Also: Fixes #8579, fixes #3055, fixes #19844.
2014-01-20 10:45:21 +08:00
Anssi Kääriäinen 20bab2cf9d Fixed #16187 -- refactored ORM lookup system
Allowed users to specify which lookups or transforms ("nested lookus")
are available for fields. The implementation is now class based.

Squashed commit of the following:

commit fa7a7195f1
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 18 10:53:24 2014 +0200

    Added lookup registration API docs

commit eb1c8ce164
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Tue Jan 14 18:59:36 2014 +0200

    Release notes and other minor docs changes

commit 11501c29c9
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Jan 12 20:53:03 2014 +0200

    Forgot to add custom_lookups tests in prev commit

commit 83173b960e
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Jan 12 19:59:12 2014 +0200

    Renamed Extract -> Transform

commit 3b18d9f3a1
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Jan 12 19:51:53 2014 +0200

    Removed suggestion of temporary lookup registration from docs

commit 21d0c7631c
Merge: 2509006 f2dc442
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Jan 12 09:38:23 2014 -0800

    Merge pull request #2 from mjtamlyn/lookups_3

    Reworked custom lookups docs.

commit f2dc4429a1
Author: Marc Tamlyn <marc.tamlyn@gmail.com>
Date:   Sun Jan 12 13:15:05 2014 +0000

    Reworked custom lookups docs.

    Mostly just formatting and rewording, but also replaced the example
    using ``YearExtract`` to  use an example which is unlikely to ever be
    possible directly in the ORM.

commit 2509006506
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Jan 12 13:19:13 2014 +0200

    Removed unused import

commit 4fba5dfaa0
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 22:34:41 2014 +0200

    Added docs to index

commit 6d53963f37
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 22:10:24 2014 +0200

    Dead code removal

commit f9cc039007
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 19:00:43 2014 +0200

    A new try for docs

commit 33aa18a6e3
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 14:57:12 2014 +0200

    Renamed get_cols to get_group_by_cols

commit c7d5f8661b
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 14:45:53 2014 +0200

    Altered query string customization for backends vendors

    The new way is trying to call first method 'as_' + connection.vendor.
    If that doesn't exist, then call as_sql().

    Also altered how lookup registration is done. There is now
    RegisterLookupMixin class that is used by Field, Extract and
    sql.Aggregate. This allows one to register lookups for extracts and
    aggregates in the same way lookup registration is done for fields.

commit 90e7004ec1
Merge: 66649ff f7c2c0a
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 13:21:01 2014 +0200

    Merge branch 'master' into lookups_3

commit 66649ff891
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Jan 11 13:16:01 2014 +0200

    Some rewording in docs

commit 31b8faa627
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 29 15:52:29 2013 +0200

    Cleanup based on review comments

commit 1016159f34
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 28 18:37:04 2013 +0200

    Proof-of-concept fix for #16731

    Implemented only for SQLite and PostgreSQL, and only for startswith
    and istartswith lookups.

commit 193cd097ca
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 28 17:57:58 2013 +0200

    Fixed #11722 -- iexact=F() produced invalid SQL

commit 08ed3c3b49
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 21 23:59:52 2013 +0200

    Made Lookup and Extract available from django.db.models

commit b99c8d83c9
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 21 23:06:29 2013 +0200

    Fixed review notes by Loic

commit 049eebc070
Merge: ed8fab7 b80a835
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 21 22:53:10 2013 +0200

    Merge branch 'master' into lookups_3

    Conflicts:
    	django/db/models/fields/__init__.py
    	django/db/models/sql/compiler.py
    	django/db/models/sql/query.py
    	tests/null_queries/tests.py

commit ed8fab7fe8
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Dec 21 22:47:23 2013 +0200

    Made Extracts aware of full lookup path

commit 27a57b7aed
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 1 21:10:11 2013 +0200

    Removed debugger import

commit 074e0f5aca
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 1 21:02:16 2013 +0200

    GIS lookup support added

commit 760e28e72b
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 1 20:04:31 2013 +0200

    Removed usage of Constraint, used Lookup instead

commit eac4776684
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 1 02:22:30 2013 +0200

    Minor cleanup of Lookup API

commit 2adf50428d
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sun Dec 1 02:14:19 2013 +0200

    Added documentation, polished implementation

commit 32c04357a8
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Nov 30 23:10:15 2013 +0200

    Avoid OrderedDict creation on lookup aggregate check

commit 7c8b3a32cc
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Nov 30 23:04:34 2013 +0200

    Implemented nested lookups

    But there is no support of using lookups outside filtering yet.

commit 4d219d4cde
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Wed Nov 27 22:07:30 2013 +0200

    Initial implementation of custom lookups
2014-01-18 11:46:19 +02:00
Tim Graham b87c59b04b Removed some unnecessary __exact operators in filters. 2014-01-17 18:12:45 -05:00
Aymeric Augustin d562527a16 Fixed #21477 -- Renamed db to using in pre/post_migrate signals. 2014-01-12 22:24:33 +01:00
Aymeric Augustin 27afd302c6 Fixed #21675 -- Added app configs for contrib apps. 2014-01-05 21:18:33 +01:00
Aymeric Augustin bfcc686d22 Removed the only_with_models_module argument of get_model[s].
Now that the refactorings are complete, it isn't particularly useful any
more, nor very well named. Let's keep the API as simple as possible.

Fixed #21689.
2013-12-30 23:59:34 +01:00
Aymeric Augustin 7b88a96553 Added AppConfig.get_models(). 2013-12-29 20:31:59 +01:00