Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2017-06-28 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
--+
 Reporter:  Jon Dufresne  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  closed
Component:  Forms |  Version:  1.11
 Severity:  Release blocker   |   Resolution:  fixed
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Tim Graham):

 The new ticket is #28345.

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.e26566776338525bddbc6050cd72c1b0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2017-06-28 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
--+
 Reporter:  Jon Dufresne  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  closed
Component:  Forms |  Version:  1.11
 Severity:  Release blocker   |   Resolution:  fixed
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 This change is released, so please open a new ticket at this point. I'm
 not sure if what you provided is sufficient to reproduce the issue. A
 sample project or a test would be helpful.

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.b2522aa05f1090124b6490dd301b461c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2017-06-28 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
--+
 Reporter:  Jon Dufresne  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Forms |  Version:  1.11
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by drunkard):

 * status:  closed => new
 * resolution:  fixed =>


--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.6ed31c607e790b1689d7ee436e227fae%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2017-06-28 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
--+
 Reporter:  Jon Dufresne  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  closed
Component:  Forms |  Version:  1.11
 Severity:  Release blocker   |   Resolution:  fixed
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by drunkard):

 This change breaks inheriting from django.forms.models.ModelForm directly.

 I'm upgrading to python3.6 + django-1.11.2, and gets wrong with this
 commit. I'm using dynamic limit_choices_to function to get user specific
 filter expr, one of my function is like:

 {{{
 def limit_export_branch():
 user = current_user()
 if user:
 bs = user.userprofile.branches_with_perms(['add_export',
 'change_export'])
 return Q(pk__in=bs.values_list('pk', flat=True),
  businesses__name=BUSINESS_BROADBAND)
 return Q(pk=-1)  # deny to avoid info leak
 }}}

 It just called once during develop server init, and won't be call while
 open a USER EDIT FORM, but it work in django admin edit page, by reading
 the code, django admin build form using modelform_factory(), with this
 commit reverted, my customized form works just fine. So, I think it's a
 regression.

 Or, the usage of ModelForm changed? but newest doc not mentioned.

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.ad8cdd5b930c0823c7a46186a6541d76%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2017-03-16 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
--+
 Reporter:  Jon Dufresne  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  closed
Component:  Forms |  Version:  1.11
 Severity:  Release blocker   |   Resolution:  fixed
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => fixed


--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.7d29c79940fa6153e37957692bbd3ef4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2017-03-15 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
--+
 Reporter:  Jon Dufresne  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Forms |  Version:  1.11
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Tim Graham ):

 In [changeset:"a95616944b9cb58c2547d1f08590b3ad3a142fe2" a956169]:
 {{{
 #!CommitTicketReference repository=""
 revision="a95616944b9cb58c2547d1f08590b3ad3a142fe2"
 [1.11.x] Refs #27563 -- Fixed ModelChoiceField.__deepcopy__() so forms
 don't share a queryset cache.

 Thanks Luke Benstead for the report Simon Charettes for the fix.

 Backport of 44f9241c48e28823b140bc4ec7515f5a88b88c32 from master
 }}}

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.7d52c9a49d371c31656ad75333206a92%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2017-03-15 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
--+
 Reporter:  Jon Dufresne  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Forms |  Version:  1.11
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by GitHub ):

 In [changeset:"44f9241c48e28823b140bc4ec7515f5a88b88c32" 44f9241c]:
 {{{
 #!CommitTicketReference repository=""
 revision="44f9241c48e28823b140bc4ec7515f5a88b88c32"
 Refs #27563 -- Fixed ModelChoiceField.__deepcopy__() so forms don't share
 a queryset cache.

 Thanks Luke Benstead for the report Simon Charettes for the fix.
 }}}

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.c7213248e47348162e76c00dce42f1c4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2017-03-14 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
--+
 Reporter:  Jon Dufresne  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Forms |  Version:  1.11
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Tim Graham):

 * has_patch:  0 => 1


Comment:

 Thanks Simon. I created a [https://github.com/django/django/pull/8178 PR]
 with your suggestion.

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.639fc0be26e46cdcf99273aa3bc35d5c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2017-03-14 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
--+
 Reporter:  Jon Dufresne  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Forms |  Version:  1.11
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Simon Charette):

 It looks like something is wrong with
 
[https://github.com/django/django/blob/e7033e00f8e1ba2ffe538e56c5088a7e94c2e45d/django/forms/models.py#L1158
 ModelChoiceField.__deepcopy__()], it should be assigning
 `self.queryset.all()` to make sure `_result_cache` isn't shared between
 instances.

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.c34b626bdc068340da50856da74e9c05%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2017-03-14 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
--+
 Reporter:  Jon Dufresne  |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Forms |  Version:  1.11
 Severity:  Release blocker   |   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Tim Graham):

 * status:  closed => new
 * severity:  Normal => Release blocker
 * version:  master => 1.11
 * has_patch:  1 => 0
 * resolution:  fixed =>
 * stage:  Ready for checkin => Accepted


Comment:

 Reopening per the regression reported in #27937.

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.d54d9797ce8b91cf9ac8ec334d650347%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2016-12-02 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
-+-
 Reporter:  Jon Dufresne |Owner:  nobody
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Jon Dufresne):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 Not sure why my
 
[https://github.com/django/django/commit/6abd6c598ea23e0a962c87b0075aa2f79f9ead36
 commit] didn't close the ticket. If anyone is aware of something I did
 wrong, please let me know so I can change my workflow.

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.b28198bd023f616fb5897f82f178cbe5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2016-12-01 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
-+-
 Reporter:  Jon Dufresne |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Claude Paroz):

 * stage:  Unreviewed => Ready for checkin


Comment:

 Looks good!

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.2726441a5669f2e7db1de133629d6941%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2016-12-01 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
-+-
 Reporter:  Jon Dufresne |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Forms|  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Jon Dufresne):

 * has_patch:  0 => 1


Comment:

 [https://github.com/django/django/pull/7651 PR]

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.3fe9d8b206c9372702f14074de086e99%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #27563: Move "Apply limit_choices_to" code from BaseModelForm to fields_for_model()

2016-12-01 Thread Django
#27563: Move "Apply limit_choices_to" code from BaseModelForm to 
fields_for_model()
+
   Reporter:  Jon Dufresne  |  Owner:  nobody
   Type:  Cleanup/optimization  | Status:  new
  Component:  Forms |Version:  master
   Severity:  Normal|   Keywords:
   Triage Stage:  Unreviewed|  Has patch:  0
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+
 I frequently use `fields_for_model()` to generate form fields dynamically
 on a model form. The form may have different fields based on the request,
 system settings,  or other input. Using `fields_for_model()` is very
 convenient to build these dynamic fields. For the most part, it is built
 consistently had the field originally been defined on `Meta.fields`.

 One shortfall I noticed, `limit_choices_to` is not applied to form field
 querysets the way it typically is for `ModelForm`s. To make the
 `fields_for_model()` function more convenient and consistent with fields
 generated by `ModelForm`, I'd like to suggest moving the "Apply
 limit_choices_to" code from `BaseModelForm` to `fields_for_model()`.

 Currently here:
 
https://github.com/django/django/blob/3507d4e773aa9ff2336e7230ba231c4ba6eb568f/django/forms/models.py#L294-L300

 Suggested location:
 
https://github.com/django/django/blob/3507d4e773aa9ff2336e7230ba231c4ba6eb568f/django/forms/models.py#L172-L173

--
Ticket URL: 
Django 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.71e75f22555214c9f2f5cc95a16c33ba%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.