Re: form: required field
thank you ! the solution is: {% for field in form %} {% if field.field.required %} blablabla {% endif %} {% endfor %} On 2 nov, 16:58, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On 11/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > how to know if a field is required on template side ? > > Search this list for "required field" and one of the first hits is this > recent thread: > > http://groups.google.com/group/django-users/browse_thread/thread/7d52... > > Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: form: required field
On 11/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > how to know if a field is required on template side ? > > Search this list for "required field" and one of the first hits is this recent thread: http://groups.google.com/group/django-users/browse_thread/thread/7d52d52ce5945be6/36367d3195812b8d?lnk=gst&q=%22required+field%22# Karen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
form: required field
how to know if a field is required on template side ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: form required field question
On 6/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Thanks... that does look like what I'm looking for. I don't really > understand how I'd put it in a model, though... I've got a situation > where if the choose a, they need to choose from one list, if they > choose b, they need to choose from another, and so on, but this is all > in the admin.. no public form. Instantiate RequiedIfOtherFieldEquals, and put it in the validator_list argument of your optional fields. Something similar to this should work: class MyModel(models.Model): required_field = models.CharField() opt_field_a = models.IntegerField( choices=C1, validator_list=[RequiedIfOtherFieldEquals('required_field', 'a')] ) opt_field_b = models.IntegerField( choices=C2, validator_list=[RequiedIfOtherFieldEquals('required_field', 'b')] ) Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: form required field question
Thanks... that does look like what I'm looking for. I don't really understand how I'd put it in a model, though... I've got a situation where if the choose a, they need to choose from one list, if they choose b, they need to choose from another, and so on, but this is all in the admin.. no public form. On May 31, 5:04 pm, "Joseph Kocherhans" <[EMAIL PROTECTED]> wrote: > On 5/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > I have the common scenario where if the user selects "other", then I > > need an "explain" box to become required. How can I do this? > > Additional validator on the field or something? > > You probably want django.core.validators.RequiredIfOtherFieldEquals > > Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
form required field question
I have the common scenario where if the user selects "other", then I need an "explain" box to become required. How can I do this? Additional validator on the field or something? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: form required field question
On 5/31/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I have the common scenario where if the user selects "other", then I > need an "explain" box to become required. How can I do this? > Additional validator on the field or something? You probably want django.core.validators.RequiredIfOtherFieldEquals Joseph --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---