#18907: Documentation regarding population of backrefs is incorrect
--------------------------------+--------------------
     Reporter:  simonpercivall  |      Owner:  nobody
         Type:  Uncategorized   |     Status:  new
    Component:  Documentation   |    Version:  1.4
     Severity:  Normal          |   Keywords:
 Triage Stage:  Unreviewed      |  Has patch:  0
Easy pickings:  0               |      UI/UX:  0
--------------------------------+--------------------
 It is stated at https://docs.djangoproject.com/en/1.4/topics/db/queries
 /#how-are-the-backward-relationships-possible in the third paragraph that
 "the first time any model is loaded" Django iterates `INSTALLED_APPS` and
 populates backrefs. Either this is plain wrong, or the text needs
 clarification.

 1. I create a minimal two-app project where app2.Model2 has a reference to
 app1.Model1 and both `app1` and `app2` are in `INSTALLED_APPS`
 2. I create a Model1: `Model1.objects.create()`
 3. I write and run a script:
 {{{#!python
 from app1.models import Model1

 m = Model1.objects.get().model2s.all()
 }}}
 4. and get
 {{{#!python
 Traceback (most recent call last):
   File "f.py", line 8, in <module>
     Model1.objects.get().model2s.all()
 AttributeError: 'Model1' object has no attribute 'model2s'
 }}}

 If I add `import app2.models`, it'll work.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18907>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to