#1891: ForeignKey with m2m filter can duplicate foreign model entries in
ModelForm/ModelChoiceField
-------------------------------------+-------------------------------------
Reporter: mattimustang@… | Owner: Chris
| Wilson
Type: Bug | Status: assigned
Component: Database layer | Version:
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Josh):
Can we add an optional keyword argument to conditionally apply the
DISTINCT select? This just bit me on a production app.
Maybe something like:
{{{
account_manager = models.ForeignKey(
User,
limit_choices_to=Q(groups__name='Sales') | Q(groups__name='Admin'),
limit_choices_distinct=True, # default False
)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/1891#comment:27>
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/080.af03e412fa4d97097fef71be2e0006bf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.