Wednesday, June 28, 2017

Re: limit_choices_to=function() not work in python-3.6+django-1.11.2



On Wednesday, June 28, 2017 at 7:56:36 PM UTC+8, Tim Graham wrote:
To get some insight, I'd try bisecting to find the Django commit where the behavior changed:
https://docs.djangoproject.com/en/dev/internals/contributing/triaging-tickets/#bisecting-a-regression


After a whole day digging that, I found the commit changed the behaviour: 6abd6c598ea23e0a962c87b0075aa2f79f9ead36, and the ticket: https://code.djangoproject.com/ticket/27563

I'm feeding back to upstream.
 
On Wednesday, June 28, 2017 at 7:10:35 AM UTC-4, Drunkard Zhang wrote:
Hi, fellows:

I was running python-3.4+django-1.9.13 previous, and upgrading to python-3.6+django-1.11.2, while testing, I found that my limit_choices_to function not working now, here's detail.

I'm using a middleware to get current user who is accessing my site, and use it in limit_choices_to function, to provide different filter based on current user. This works great with python-3.4 + django-1.9.13; and using django-crispy-forms to render user forms.

After upgraded to python-3.6+django-1.11, limit_choices_to function didn't called when I opened a USER EDIT FORM (by adding print() to the function), but it still works with django admin.

So the question is:
1. The difference of init procedures between django 1.9.13 and 1.11.2? Because 1.9.13 won't exec limit_choices_to function on init, while 1.11.2 does.
2. Where should I fix the problem? django init settings, my form, or even django-crispy-forms?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ce898186-ba03-4c32-b260-30ee93c5c722%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment