Opened 6 years ago

Closed 6 years ago

#30247 closed Bug (invalid)

ModelMultipleChoiceField Bug - Initial Values has to be in queryset, does not make sense

Reported by: Josef Korbel Owned by: nobody
Component: Forms Version: 2.1
Severity: Normal Keywords: ModelMultipleChoiceField
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When using ModelMultipleChoiceField, the initial values need to be in the queryset, or the widget will be empty. As my queryset is collection of unassigned objects, my initial will never by in my queryset, thus making this undoable for me, here are more details on SO.

https://stackoverflow.com/questions/54941814/django-modelmultiplechoicefield-1n-initial/54998957#54998957

Change History (2)

comment:1 by Josef Korbel, 6 years ago

Component: UncategorizedForms
Type: UncategorizedBug

comment:2 by Carlton Gibson, 6 years ago

Resolution: invalid
Status: newclosed

You've misunderstood what's going on here. queryset in this case means the set of allowed values. All values, whether initial or not, must be in queryset.

If you're not clear on this please see TicketClosingReasons/UseSupportChannels.

Note: See TracTickets for help on using tickets.
Back to Top