#20143: Lazy loading of related fields does not work for non-loaded models
-------------------------------------+-------------------------------------
Reporter: andreas_pelme | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.5
(models, ORM) | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by andreas_pelme):
When digging into this, I also found another similar problem with reverse
relations.
This works as expected since all models are forcefully-loaded:
{{{
lazy_model_loading $ python manage.py shell
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on
darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from bar.models import Bar
>>> Bar().foo_set
<django.db.models.fields.related.RelatedManager object at 0x1080cea10>
}}}
This does not work:
{{{
lazy_model_loading $ DJANGO_SETTINGS_MODULE=lazy_model_loading.settings
python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on
darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from bar.models import Bar
>>> Bar().foo_set
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Bar' object has no attribute 'foo_set'
}}}
Shall I open a new ticket for this, or is it better to track it here too?
--
Ticket URL: <https://code.djangoproject.com/ticket/20143#comment:5>
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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.