Commit Graph

30 Commits

Author SHA1 Message Date
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Loic Bistuer 71ada3a8e6 Fixed #6707 -- Added RelatedManager.set() and made descriptors' __set__ use it.
Thanks Anssi Kääriäinen, Carl Meyer, Collin Anderson, and Tim Graham for the reviews.
2015-02-05 12:45:08 +07:00
Claude Paroz b4ac232907 Fixed #24099 -- Removed contenttype.name deprecated field
This finsishes the work started on #16803.
Thanks Simon Charette, Tim Graham and Collin Anderson for the
reviews.
2015-01-16 20:21:34 +01:00
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
Tim Graham 30b44cea38 Fixed flake8 warning. 2014-10-08 18:10:50 -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
Loic Bistuer 2f3a4cd573 Removed numbering from the models.py header of some test packages.
This is a reliqua from the early days of the modeltests/regressiontests era.
2014-09-24 17:28:56 +07:00
Anssi Kääriäinen efe87d3e48 Fixed #22992 -- regression in .filter(generic_fk=...) error message
Generic Foreign Keys can't be used as lhs in lookups for historical
reasons. Django 1.6 gave a FieldDoesNotExist exception when using GFKs
as lhs in lookups, but due to regression caused by lookup refactor patch
(20bab2cf9d) the exception type was
changed to AttributeError.

It might be a good idea to add support for gfk__exact and gfk__in lookups
later on.

Thanks to glicerinu@gmail.com for the report. The code in this commit
was written by Tim Graham.
2014-07-14 10:50:41 -04:00
José L. Patiño 7b064e5390 Split GenericRelationsTests.test_generic_relations into several tests; refs #18586. 2014-06-01 12:36:32 -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
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
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
Jason Myers 7a61c68c50 PEP8 cleanup
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:50:49 -05:00
Alasdair Nicol b289fcf1bf Fixed #21288 -- Fixed E126 pep8 warnings 2013-10-21 08:31:30 -04:00
Tim Graham 96d1d4e292 Removed unused local variables in tests. 2013-10-19 08:31:38 -04:00
Alasdair Nicol a800036981 Fixed #21287 -- Fixed E123 pep8 warnings 2013-10-18 10:07:39 +01:00
Alasdair Nicol bab9123daa Fixed #21268 -- Fixed E303 pep8 warnings 2013-10-18 01:46:24 +01:00
Bouke Haarsma 3918eeb9fd Fixed #7551 -- Made GFK allow None init argument.
Thanks SamBull for the report.
2013-10-16 07:03:46 -04:00
Simon Charette 948d209ada Fixed #21217 -- Avoid connecting `(pre|post)_init` signals to abstract senders. 2013-10-04 16:23:06 -04:00
Pablo Mouzo b11564fd36 Fixed #16869 -- BaseGenericInlineFormSet.save_new should use form's save() method
Thanks mattaustin for the report and Pablo Recio (pyriku) for the patch.
2013-09-07 20:00:38 -04:00
Tim Graham f7290581fe Fixed a regression with get_or_create and virtual fields.
refs #20429

Thanks Simon Charette for the report and review.
2013-08-21 08:30:21 -04:00
Alasdair Nicol 22c6497f99 Fixed #20895 -- Made check management command warn if a BooleanField does not have a default value
Thanks to Collin Anderson for the suggestion and Tim Graham for
reviewing the patch.
2013-08-15 19:47:26 -04:00
Claude Paroz 5c1143910e Removed most of absolute_import imports
Should be unneeded with Python 2.7 and up.
Added some unicode_literals along the way.
2013-07-29 20:28:13 +02:00
Bojan Mihelac b00c6371af Fixed #17927 -- Added initial values support for BaseGenericInlineFormSet
Thanks Fak3 for the suggestion.
2013-06-05 07:59:59 -04:00
Gavin Wahl 48424adaba Fixed #17648 -- Add `for_concrete_model` to `GenericForeignKey`.
Allows a `GenericForeignKey` to reference proxy models. The default
for `for_concrete_model` is `True` to keep backwards compatibility.

Also added the analog `for_concrete_model` kwarg to
`generic_inlineformset_factory` to provide an API at the form level.
2013-05-23 19:03:14 -04:00
Marc Tamlyn 09f8652765 Use assertIsInstance in tests.
Gives much nicer errors when it fails.
2013-05-21 10:42:15 +01:00
Anssi Kääriäinen c0d8932a6d Fixed #19939 -- generic relations + split_exclude regression
Added a test, the issue was already fixed (likely by the patch
for #19385).
2013-05-11 03:48:58 +03:00
Luke Plant f026a519ae Fixed #19733 - deprecated ModelForms without 'fields' or 'exclude', and added '__all__' shortcut
This also updates all dependent functionality, including modelform_factory
 and modelformset_factory, and the generic views `ModelFormMixin`,
 `CreateView` and `UpdateView` which gain a new `fields` attribute.
2013-05-09 16:44:36 +01:00
Loic Bistuer 6983a1a540 Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
Florian Apolloner 89f40e3624 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00