#18427: limit_choices_to won't limit correctly
-------------------------------------+-------------------------------------
     Reporter:  thanos@…             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  contrib.admin        |                  Version:  1.4
     Severity:  Normal               |               Resolution:
     Keywords:  limit_choices_to     |             Triage Stage:  Accepted
  admin                              |      Needs documentation:  0
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by svisser):

 Not as easy as it looks.

 It happens because the response that `response_add` sends (in
 `django.contrib.admin.options.ModelAdmin`) unconditionally calls the
 JavaScript that updates the admin control. In practise the foreign key
 configuration may be complex so it may not be obvious to the user why the
 newly added object does not appear in the list. So it seems to me one
 would also need to inform the user about this.

 Also, creating the new object happens by posting to the `add_view` and
 that view doesn't know what happens afterwards with that object. Solving
 this ticket would need a way of reevaluating the constraints in
 `limit_choices_to` but also elegantly communicate that to the front-end.

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


Reply via email to