#14113: Access to extra fields in M2M relations
---------------------------------------------------+------------------------
Reporter: jprafael | Owner: nobody
Status: closed | Milestone:
Component: Database layer (models, ORM) | Version: 1.2
Resolution: invalid | Keywords:
Many2ManyField intermediary fields
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Changes (by russellm):
* status: new => closed
* needs_better_patch: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_docs: => 0
Comment:
This is already possible -- you just need to think about your data model
in a slightly different way, and look at the intermediate model as a
fully-fledged model with a foreign key:
{{{
{% for recipe in recipes %}
{% for rp in recipe.recipeproduct_set.all %}
product: {{ rp.product.name }} ({{ rp.product.amount }} in
stock)
amount: {{ rp.amount }}
{% endfor %}
{% endfor %}
}}}
Merging the attributes of the intermediate class onto the m2m objects was
considered at the time the m2m-intermediate feature was under development,
and was rejected. Search the archives and ticket #6095 for reasoning.
--
Ticket URL: <http://code.djangoproject.com/ticket/14113#comment:1>
Django <http://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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.