Re: [Django] #13972: Field initial value callable should take a request object as an argument

2013-03-29 Thread Django
#13972: Field initial value callable should take a request object as an argument
-+-
 Reporter:  mitar|Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Forms|  Version:  1.2
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:   | Triage Stage:  Design
Has patch:  0|  decision needed
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-

Comment (by mitar):

 I know that I can do this in the view. But I find this not a nice
 separation programming logic. Then I have to repeat again and again this
 in all the views, where it could just be a nature of the view. Yes, I
 could create a mixin for class-based views to handle this, but it is still
 complicating things. `request` should really be available everywhere. Like
 there is a way (processors) to get it into the templates, there should be
 a way to get it into forms.

 Maybe better way would be that default values functions could be methods
 of form? So then you would access to `self` where you could store anything
 you want (or pass `request` in the constructor).

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #13972: Field initial value callable should take a request object as an argument

2013-03-29 Thread Django
#13972: Field initial value callable should take a request object as an argument
-+-
 Reporter:  mitar|Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Forms|  Version:  1.2
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:   | Triage Stage:  Design
Has patch:  0|  decision needed
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-

Comment (by charettes):

 You should have this `initial_data_for_user` logic in your views and pass
 it along to your form when creating it.

 See the [https://docs.djangoproject.com/en/dev/#getting-help getting help
 section] if you need some support.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #13972: Field initial value callable should take a request object as an argument

2013-03-28 Thread Django
#13972: Field initial value callable should take a request object as an argument
-+-
 Reporter:  mitar|Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Forms|  Version:  1.2
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:   | Triage Stage:  Design
Has patch:  0|  decision needed
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-

Comment (by mitar):

 But how can you then enable forms to have default values based on the
 user? For example, that default language is set based on his or her IP?

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #13972: Field initial value callable should take a request object as an argument

2013-03-23 Thread Django
#13972: Field initial value callable should take a request object as an argument
-+-
 Reporter:  mitar|Owner:  nobody
 Type:  New feature  |   Status:  closed
Component:  Forms|  Version:  1.2
 Severity:  Normal   |   Resolution:  wontfix
 Keywords:   | Triage Stage:  Design
Has patch:  0|  decision needed
  Needs tests:  0|  Needs documentation:  0
Easy pickings:  0|  Patch needs improvement:  0
 |UI/UX:  0
-+-
Changes (by apollo13):

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


Comment:

 Jupp, wontfix, forms shouldn't have to know about the request.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #13972: Field initial value callable should take a request object as an argument

2011-04-01 Thread Django
#13972: Field initial value callable should take a request object as an argument
--+--
   Reporter:  mitar   |Owner:  nobody
   Type:  New feature |   Status:  new
  Milestone:  |Component:  Forms
Version:  1.2 | Severity:  Normal
 Resolution:  | Keywords:
   Triage Stage:  Design decision needed  |Has patch:  0
Needs documentation:  0   |  Needs tests:  0
Patch needs improvement:  0   |
--+--
Changes (by graham_king):

 * type:   => New feature
 * severity:   => Normal


-- 
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #13972: Field initial value callable should take a request object as an argument

2010-10-04 Thread Django
#13972: Field initial value callable should take a request object as an argument
-+--
  Reporter:  mitar   | Owner:  nobody
Status:  new | Milestone:
 Component:  Forms   |   Version:  1.2   
Resolution:  |  Keywords:
 Stage:  Design decision needed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by mk):

  * stage:  Unreviewed => Design decision needed

Comment:

 The form classes do not know anything about requests currently, and the
 prevailing opinion is that this should not be changed in the future.

 The last time that coupling requests and forms came up was during the last
 refactoring of CSRF protection. It was rejected.

 This ticket is probably a candidate for "wontfix", this is to be decided
 by the core developers though.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #13972: Field initial value callable should take a request object as an argument

2010-07-21 Thread Django
#13972: Field initial value callable should take a request object as an argument
-+--
  Reporter:  mitar   | Owner:  nobody
Status:  new | Milestone:
 Component:  Forms   |   Version:  1.2   
Resolution:  |  Keywords:
 Stage:  Unreviewed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by mitar):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 An example how this can be useful can be found in [comment:ticket:5446:25
 #5446].

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



[Django] #13972: Field initial value callable should take a request object as an argument

2010-07-21 Thread Django
#13972: Field initial value callable should take a request object as an argument
---+
 Reporter:  mitar  |   Owner:  nobody
   Status:  new|   Milestone:
Component:  Forms  | Version:  1.2   
 Keywords: |   Stage:  Unreviewed
Has_patch:  0  |  
---+
 Currently it is possible to define initial value for a field as a
 callable. But this is quite limited in use as it does not take any context
 in which it should run.

 I am proposing that it should take a request object. In this way it is
 possible to set initial values based on a request. For example, based on
 GeoIP information. We should pass a request object to the form constructor
 which would then pass it along to the those callables.

 I am attaching a short helper function which allows me that I define such
 callables already. It postprocesses the form class so that request is
 available to callables. So in the view it is necessary just to construct
 your form with:

 {{{
 form = initial_accepts_request(request, MyForm)()
 }}}

 It still allows initial values to be passed at construction time and they
 override callables.

 But it would be much better if this would be officially supported.

-- 
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 post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.