Re: [Django] #10427: Bound field needs an easy way to get form value

2020-04-09 Thread Django
#10427: Bound field needs an easy way to get form value
--+
 Reporter:  Ludvig Ericson|Owner:  Chris Beaven
 Type:|   Status:  closed
Component:  Forms |  Version:  master
 Severity:|   Resolution:  fixed
 Keywords:  form field value  | Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak ):

 In [changeset:"eeab4ab82e0422855a5c454a600730c538b256cd" eeab4ab]:
 {{{
 #!CommitTicketReference repository=""
 revision="eeab4ab82e0422855a5c454a600730c538b256cd"
 [3.0.x] Refs #10427 -- Corrected BoundField.css_classes() signature in
 docs.

 Backport of 734fde771433b9ea525a2b0f4d8ebb3ae426b2fa 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.4b1e43af5d6856132601b1aeb085f942%40djangoproject.com.


Re: [Django] #10427: Bound field needs an easy way to get form value

2020-04-09 Thread Django
#10427: Bound field needs an easy way to get form value
--+
 Reporter:  Ludvig Ericson|Owner:  Chris Beaven
 Type:|   Status:  closed
Component:  Forms |  Version:  master
 Severity:|   Resolution:  fixed
 Keywords:  form field value  | Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Mariusz Felisiak ):

 * ui_ux:   => 0
 * easy:   => 0


Comment:

 In [changeset:"734fde771433b9ea525a2b0f4d8ebb3ae426b2fa" 734fde7]:
 {{{
 #!CommitTicketReference repository=""
 revision="734fde771433b9ea525a2b0f4d8ebb3ae426b2fa"
 Refs #10427 -- Corrected BoundField.css_classes() signature in docs.
 }}}

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.21d4286ba767833f60b63010ede24476%40djangoproject.com.


Re: [Django] #10427: Bound field needs an easy way to get form value

2010-12-01 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  SmileyChris 
Status:  closed| Milestone:  1.3 
 Component:  Forms |   Version:  SVN 
Resolution:  fixed |  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by CollinAnderson):

 Thank you!

-- 
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] #10427: Bound field needs an easy way to get form value

2010-11-21 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  SmileyChris 
Status:  new   | Milestone:  1.3 
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by SmileyChris):

  * owner:  nobody => SmileyChris
  * status:  reopened => new

Comment:

 I'm looking to commit at least an abstraction of the values generation in
 the ``BoundField.as_widget`` method.

 Here's my branch comparison:
 https://github.com/SmileyChris/django/compare/master...10427-BoundField.value

-- 
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] #10427: Bound field needs an easy way to get form value

2010-10-15 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  1.3 
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by dirleyrls):

 * cc: dirley...@gmail.com (added)
  * milestone:  => 1.3

-- 
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] #10427: Bound field needs an easy way to get form value

2010-10-14 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by postal2600):

 * cc: postal2...@yahoo.com (added)

-- 
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] #10427: Bound field needs an easy way to get form value

2010-09-20 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by trunet):

 * cc: wsart...@gmail.com (added)

Comment:

 Replying to [comment:29 toxik]:
 > Why isn't this merged into trunk yet? It's been accepted for over a
 year; Django 1.2 was just released. People are clearly interested in this.
 What's the holdup? Sure core committers limited time etc. but for the love
 of god, a year?

 I second this!

-- 
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] #10427: Bound field needs an easy way to get form value

2010-09-10 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by toxik):

 Why isn't this merged into trunk yet? It's been accepted for over a year;
 Django 1.2 was just released. People are clearly interested in this.
 What's the holdup? Sure core committers limited time etc. but for the love
 of god, a year?

-- 
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] #10427: Bound field needs an easy way to get form value

2010-08-31 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by martin):

 * cc: martin.paque...@gmail.com (added)

-- 
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] #10427: Bound field needs an easy way to get form value

2010-08-13 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by anonymous):

 * cc: m...@typethink.com (added)

-- 
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] #10427: Bound field needs an easy way to get form value

2010-06-15 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by proppy):

 * cc: pro...@aminche.com (added)

-- 
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] #10427: Bound field needs an easy way to get form value

2010-03-31 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by anonymous):

 * cc: kmik...@gmail.com (added)

-- 
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] #10427: Bound field needs an easy way to get form value

2010-02-12 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by issac.ke...@gmail.com):

 I had an issue with this, causing this error:

  TemplateSyntaxError at /first/admin
  Caught an exception while rendering: global name 'FileField' is not
 defined

 importing 'FileField' at the top fixed it

 {{{
 from django.forms import ChoiceField, FileField

 from django import template
 register = template.Library()

 @register.filter(name='field_value')
 def field_value(field):
 """
 Returns the value for this BoundField, as rendered in widgets.
 """
 if field.form.is_bound:
 if isinstance(field.field, FileField) and field.data is
 None:
 val = field.form.initial.get(field.name,
 field.field.initial)
 else:
 val = field.data
 else:
 val = field.form.initial.get(field.name,
 field.field.initial)
 if callable(val):
 val = val()
 if val is None:
 val = ''
 return val

 @register.filter(name='display_value')
 def display_value(field):
 """
 Returns the displayed value for this BoundField, as rendered in
 widgets.
 """
 value = field_value(field)
 if isinstance(field.field, ChoiceField):
 for (val, desc) in field.field.choices:
 if val == value:
 return desc
 return value
 }}}

-- 
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] #10427: Bound field needs an easy way to get form value

2009-11-24 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by jameshfis...@gmail.com):

 To update the filters by zanuxzan:

 {{{
 from django.forms import ChoiceField

 from django import template
 register = template.Library()

 @register.filter(name='field_value')
 def field_value(field):
 """
 Returns the value for this BoundField, as rendered in widgets.
 """
 if field.form.is_bound:
 if isinstance(field.field, FileField) and field.data is
 None:
 val = field.form.initial.get(field.name,
 field.field.initial)
 else:
 val = field.data
 else:
 val = field.form.initial.get(field.name,
 field.field.initial)
 if callable(val):
 val = val()
 if val is None:
 val = ''
 return val

 @register.filter(name='display_value')
 def display_value(field):
 """
 Returns the displayed value for this BoundField, as rendered in
 widgets.
 """
 value = field_value(field)
 if isinstance(field.field, ChoiceField):
 for (val, desc) in field.field.choices:
 if val == value:
 return desc
 return value
 }}}

-- 
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] #10427: Bound field needs an easy way to get form value

2009-11-23 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by jameshfis...@gmail.com):

 Replying to [comment:21 paulschreiber]:
 In display_value, I think
 value = field.value
 should be
 value = field_value(field)

 field.value would make this whole ticket pointless :)

-- 
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=.




Re: [Django] #10427: Bound field needs an easy way to get form value

2009-11-11 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by paulschreiber):

 * cc: paulschrei...@gmail.com (added)

-- 
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] #10427: Bound field needs an easy way to get form value

2009-10-20 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by zanuxzan):

 Sorry... correction!

 {{{
 @register.filter(name='field_value')
 def field_value(field):
 """
 Returns the value for this BoundField, as rendered in widgets.
 """
 if not field.form.is_bound:
 val = field.form.initial.get(field.name, field.field.initial)
 if callable(val):
 val = val()
 else:
 if isinstance(field.field, FileField) and field.data is None:
 val = field.form.initial.get(field.name, field.field.initial)
 else:
 val = field.data
 if val is None:
 val = ''
 return val

 @register.filter(name='display_value')
 def display_value(field):
 """
 Returns the displayed value for this BoundField, as rendered in
 widgets.
 """
 value = field.value
 if isinstance(field.field, ChoiceField):
 for (val, desc) in field.field.choices:
 if val == value:
 return desc
 return field.value
 }}}

-- 
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] #10427: Bound field needs an easy way to get form value

2009-10-20 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by zanuxzan):

 As taken from the last patch, I think if your going to do this with a
 template tag it should be as follows;

 {{{
 @register.filter(name='field_value')
 def field_value(field):
 """
 Returns the value for this BoundField, as rendered in widgets.
 """
 if not field.form.is_bound:
 val = field.form.initial.get(field.name, field.field.initial)
 if callable(val):
 val = val()
 else:
 if isinstance(field.field, FileField) and field.data is None:
 val = field.form.initial.get(field.name, field.field.initial)
 else:
 val = field.data
 if val is None:
 val = ''
 return val

 @register.filter(name='display_value')
 def display_value(field):
 """
 Returns the displayed value for this BoundField, as rendered in
 widgets.
 """
 value = field.value
 if isinstance(field.field, ChoiceField):
 for (val, desc) in field.field.choices:
 if val == value:
 return desc
 return field.value
 display_value = property(_display_value)
 }}}

 The one above produced errors for me.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-08-04 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by simple10):

 Alternatively, you can use the following template filter until this patch
 is added to Django core.


 {{{
 @register.filter(name='field_value')
 def field_value(field):
 value = field.form.initial[field.name]
 if not value:
 return ''
 if isinstance(field.field, ChoiceField):
 value = str(value)
 for (val, desc) in field.field.choices:
 if val == value:
 return desc
 return value

 }}}

 Usage:

 {{{
 {{ form.field|field_value }}
 {{{

-- 
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] #10427: Bound field needs an easy way to get form value

2009-07-22 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by pdonis):

 I'm using this patch and it's working well for me (in fact, I was in the
 process of re-inventing this fix for myself when I found this ticket).
 Just one comment: with the `display_value` method available, one obvious
 place to use it would be in the preview template used by
 contrib.formtools.preview.FormPreview. It would be a simple one-line
 change: instead of:

 field.data

 it would say:

 field.display_value

 I'm attaching a patch against the current trunk (r11298) that's identical
 to the r10755 patch except that it adds the above one-line change. I
 realize that most users probably won't directly use the formtools
 templates as-is, but I expect many will look at them for guidance (I know
 I did), so it seems to me that they should reflect the "best practice".

-- 
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] #10427: Bound field needs an easy way to get form value

2009-07-17 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by Michael Stevens ):

 This would be very handy for me having spent hours trying and failing to
 do related things.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-06-04 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by margieroginski):

 Ah ... I see!  Sorry, my mistake.  You know, I have been ignorant of all
 those little '_' floating around my code which I don't even need.  Thanks
 for clarifying Alex.  I have read up on the whole internationalization
 scheme and your response makes sense, of course.  So my report above and
 assessment of the problem was obviously wrong - so developers, just ignore
 it.  Sorry for the extra noise.

 Margie

-- 
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] #10427: Bound field needs an easy way to get form value

2009-06-03 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by Alex):

 display_value returns a transalatable string because you have it marked
 for translation(the _ which are ugettext_lazy calls).  To convert it to a
 string (which also translates it), use force_unicode from
 django.utils.encoding.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-06-03 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by margieroginski):

 I've started using this patch - it's very useful (Thanks!).  One thing I'm
 finding is that it display_value does not return a useful string in the
 case where the form field is a !TypedChoiceField that is in a form that is
 a !ModelForm.  For example, if I have a model like this:

 {{{

 class Task(models.Model):
 PRIORITY_CHOICES = (
 (1, _('1 (Critical)')),
 (2, _('2 (High)')),
 (3, _('3 (Normal)')),
 )

 priority = models.IntegerField(choices=PRIORITY_CHOICES, blank=True,
 null=True,
help_text=_('1 = Highest Priority, 5 =
 Low Priority'))

 }}}

 and the form is a !ModelForm, like this:

 {{{

 class TaskForm(forms.ModelForm):
 class Meta:
 model = Task

 }}}

 When I get the display_value for the form field, I get

 {{{  }}}

 Here's some pdb output that shows the problem:

 {{{

 (Pdb) type(bf)
 

 (Pdb) print bf
 
 -
 1 (Critical)
 2 (High)
 3 (Normal)
 4 (Low)
 5 (Very Low)
 
 (Pdb) bf.display_value
 
 (Pdb)

 }}}

 I tried replicating this by creating a !ChoiceField in my form, and in
 that case I don't get the same behavior, so this is somehow related to it
 being a !ModelForm.For example, if in my !TaskForm I define priority
 like this:

 {{{
 priority = forms.ChoiceField(choices=PRIORITY_CHOICES)
 }}}

 In that case display_value returns the expected string:

 {{{
 (Pdb) bf.display_value
 '4 (low)'
 }}}

 I'm familiar with a lot of the django source, but it's not clear to me
 what this proxy is or why it is there, so I just wanted to report the
 issue, since I'm sure the intended behvior is not to have display_value
 return the proxy string.

 Anyway, aside from this small problem, I think this is very nice
 refactoring of the code.

 Margie

-- 
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] #10427: Bound field needs an easy way to get form value

2009-05-23 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by viksit):

 * cc: vik...@gmail.com (added)

Comment:

 Second this solution!

 Added cc.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-05-22 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by gabor):

 * cc: ga...@nekomancer.net (added)

-- 
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] #10427: Bound field needs an easy way to get form value

2009-05-13 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by emes):

 Replying to [comment:9 emes]:
 > 1. Why doesn't it take "initial" attribute into account?
 Ok, we're in bound form. Sorry for this question ;)

 > 2. With ChoiceField the db value is returned, not the display one, which
 is not useful within templates.
 And here's the patch which does it, by adding "display_value" method which
 looks up choices for the matching description.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-05-13 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Comment (by emes):

 Two issues here:
 1. Why doesn't it take "initial" attribute into account?
 2. With ChoiceField the db value is returned, not the display one, which
 is not useful within templates.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-05-09 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by emes):

 * cc: mic...@salaban.info (added)

-- 
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] #10427: Bound field needs an easy way to get form value

2009-03-17 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  0 |   Needs_tests:  0   
Needs_better_patch:  0 |  
---+
Changes (by toxik):

  * needs_better_patch:  1 => 0
  * needs_docs:  1 => 0

Comment:

 I'm very sorry about attaching this massive amount of patches, but I
 figured using "replace existing" when there are already renamed patches
 would get confusing.

 Replying to [comment:6 mtredinnick]:
 > Calling a function using parentheses doesn't look at all weird. Normal
 code doesn't need to access the data attribute (yes, it should also have
 been a method) on a `BoundField`, so that's not particular relevant in the
 public API.

 Yeah, sure, but then it should really be a verb/verb+noun, and not a noun.
 Like "get_value". I don't see the big win in adding asymmetry and yet not
 gaining anything; it could just as well be an actual instance attribute
 (and probably should be?)

 Bikeshed away, however.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-03-08 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  1 |   Needs_tests:  0   
Needs_better_patch:  1 |  
---+
Comment (by mtredinnick):

 Sorry about the name mixup, that was just me not concentrating. You choose
 your username; live with the decision.

 Calling a function using parentheses doesn't look at all weird. Normal
 code doesn't need to access the data attribute (yes, it should also have
 been a method) on a `BoundField`, so that's not particular relevant in the
 public API.

 Anyway, add documentation and I, or somebody, will bikeshed the rest at
 commit time.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-03-08 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  1 |   Needs_tests:  0   
Needs_better_patch:  1 |  
---+
Comment (by toxik):

 Replying to [comment:3 mtredinnick]:
 > Yeah, this doesn't already exist. All the initial computations can't be
 simulated in a form. I thought this would have been a dupe of something
 else, though, since I've asked at least three people on the mailing list
 to open a ticket when they've asked about it. Apparently "will to fix"
 doesn't match "will to complain". Thanks for going the next step, Mike
 (but, geez, dude... how many attempts does it take to get the patch
 correct?)

 It might be useful to note that I'm Ludvig Ericson, or `lericson`. (And
 would love for my Trac & Subversion username to change.)

 It took some attempts because I was a bit quick on the draw, and I started
 noticing issues after starting to use it.

 Replying to [comment:4 mtredinnick]:
 > The patch itself looks ok, although I'd get rid of the property. A
 method will do fine, since it indicates in Python code that there's some
 computation going on and still looks the same in a template.
 >
 > Needs documentation, too.

 Regarding it being a property, I chose that to be consistent with the data
 property. I imagine it won't only be used from templates either, and
 `my_form['field'].value()` looks weird.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-03-07 Thread Django
#10427: Bound field needs an easy way to get form value
---+
  Reporter:  toxik | Owner:  nobody  
Status:  reopened  | Milestone:  
 Component:  Forms |   Version:  SVN 
Resolution:|  Keywords:  form field value
 Stage:  Accepted  | Has_patch:  1   
Needs_docs:  1 |   Needs_tests:  0   
Needs_better_patch:  1 |  
---+
Changes (by mtredinnick):

  * needs_better_patch:  0 => 1
  * stage:  Unreviewed => Accepted
  * needs_docs:  0 => 1

Comment:

 The patch itself looks ok, although I'd get rid of the property. A method
 will do fine, since it indicates in Python code that there's some
 computation going on and still looks the same in a template.

 Needs documentation, too.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-03-07 Thread Django
#10427: Bound field needs an easy way to get form value
-+--
  Reporter:  toxik   | Owner:  nobody  
Status:  reopened| Milestone:  
 Component:  Forms   |   Version:  SVN 
Resolution:  |  Keywords:  form field value
 Stage:  Unreviewed  | Has_patch:  1   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Comment (by mtredinnick):

 Yeah, this doesn't already exist. All the initial computations can't be
 simulated in a form. I thought this would have been a dupe of something
 else, though, since I've asked at least three people on the mailing list
 to open a ticket when they've asked about it. Apparently "will to fix"
 doesn't match "will to complain". Thanks for going the next step, Mike
 (but, geez, dude... how many attempts does it take to get the patch
 correct?)

-- 
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] #10427: Bound field needs an easy way to get form value

2009-03-07 Thread Django
#10427: Bound field needs an easy way to get form value
-+--
  Reporter:  toxik   | Owner:  nobody  
Status:  reopened| Milestone:  
 Component:  Forms   |   Version:  SVN 
Resolution:  |  Keywords:  form field value
 Stage:  Unreviewed  | Has_patch:  1   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Changes (by toxik):

  * status:  closed => reopened
  * resolution:  invalid =>

Comment:

 I'm going to take the liberty of reopening this ticket, because they're
 not the same.

 `f.value` takes initial data into account (both on form level and field
 level), as well as data. It only uses data when the form is a bound form.

-- 
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] #10427: Bound field needs an easy way to get form value

2009-03-07 Thread Django
#10427: Bound field needs an easy way to get form value
-+--
  Reporter:  toxik   | Owner:  nobody  
Status:  closed  | Milestone:  
 Component:  Forms   |   Version:  SVN 
Resolution:  invalid |  Keywords:  form field value
 Stage:  Unreviewed  | Has_patch:  1   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Changes (by jacob):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => invalid
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 This already exists, it's just spelled `{{ form.field.data }}``.

-- 
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
-~--~~~~--~~--~--~---



[Django] #10427: Bound field needs an easy way to get form value

2009-03-07 Thread Django
#10427: Bound field needs an easy way to get form value
--+-
 Reporter:  toxik |   Owner:  nobody
   Status:  new   |   Milestone:
Component:  Forms | Version:  SVN   
 Keywords:  form field value  |   Stage:  Unreviewed
Has_patch:  1 |  
--+-
 When you want to render your own forms in templates, without any sort of
 widgetery, you bump into an issue: it is impossible to get the actual
 value of a field in a succinct and clean way.

 Looking at Django's code for figuring this out, it clearly is a non-
 trivial task, and one you can easily get wrong.

 So, to remedy this, I suggest adding a `value` attribute to `BoundField`,
 which simply returns that exact value. This could be used in templates
 like so:

 {{{
 #!jinja
 
 }}}

 I for one find this both intuitive and readable.

-- 
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
-~--~~~~--~~--~--~---