#16920: Models with GenericRelation are unnecessarily validated for clashes in
reverse manager accessor
-------------------------------------+-------------------------------------
     Reporter:  r1cky                |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.3
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by gabejackson):

 Wrote two tests to cover this.

 On django 1.5.1:
 {{{
 gabejackson@jax: tests# PYTHONPATH=..:$PYTHONPATH python ./runtests.py
 --settings=test_sqlite generic_relations
 Creating test database for alias 'default'...
 Creating test database for alias 'other'...
 ..F...F..
 ======================================================================
 FAIL: test_generic_relation_related_name_not_allowed
 (generic_relations.tests.GenericRelationsTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 
"/Users/gabejackson/Documents/pycharm/django-1.6.2/tests/generic_relations/tests.py",
 line 245, in test_generic_relation_related_name_not_allowed
     class InvalidGenericRelationModel(models.Model):
 AssertionError: TypeError not raised

 ======================================================================
 FAIL: test_multiple_gen_rel_with_same_class_name
 (generic_relations.tests.GenericRelationsTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 
"/Users/gabejackson/Documents/pycharm/django-1.6.2/tests/generic_relations/tests.py",
 line 259, in test_multiple_gen_rel_with_same_class_name
     self.fail("validate() failed with: %s" % e)
 AssertionError: validate() failed with: One or more models did not
 validate:
 appone.post: Accessor for m2m field 'topic' clashes with related m2m field
 'Topic.post_set'. Add a related_name argument to the definition for
 'topic'.
 apptwo.post: Accessor for m2m field 'topic' clashes with related m2m field
 'Topic.post_set'. Add a related_name argument to the definition for
 'topic'.


 ----------------------------------------------------------------------
 Ran 9 tests in 0.107s

 FAILED (failures=2)
 Destroying test database for alias 'default'...
 Destroying test database for alias 'other'...
 }}}

 on master:
 {{{
 Testing against Django installed in '/Users/gabejackson/Documents/pycharm
 /django-generic-rel-reverse/django'
 Creating test database for alias 'default'...
 Creating test database for alias 'other'...
 .........................
 ----------------------------------------------------------------------
 Ran 25 tests in 0.210s

 OK
 Destroying test database for alias 'default'...
 Destroying test database for alias 'other'...
 }}}

 Pull Request is here: [https://github.com/django/django/pull/2407]

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16920#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.e0b7a9e111a6cee109bf890dc87f190b%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to