Re: forms, hidden fields

2011-01-20 Thread niall-oc
Bang on the head :-)

Cheers for that

On Jan 18, 5:55 pm, Brian Neal  wrote:
> On Jan 18, 8:32 am, niall-oc  wrote:
>
> > ...
> > There is a simple form.  My question is how do you set a field to be
> > hidden.
>
> >http://docs.djangoproject.com/en/1.1/topics/forms/#looping-over-the-f...
>
> > This document explains how you may check if a field is hidden, however
> > there seems to be no information on how to initially set the field to
> > be hidden. I've tried adding hidden=True and is_hidden=True to the
> > above class but to no avail.
>
> > Any help would be really appreciated
>
> Hi - please see the docs on form widgets and how you can change out a
> form field's default widget:
>
> http://docs.djangoproject.com/en/1.2/ref/forms/widgets/http://docs.djangoproject.com/en/1.2/ref/forms/widgets/#specifying-wi...
>
> I suspect you'll want to specify a HiddenInput widget for one or more
> of your form fields.
>
> Best,
> BN

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: template tag arithmetic

2011-01-18 Thread niall-oc
http://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#add

There is loop.counter and loop.counter0. loop.counter starts from 1,
and loop.counter0 starts from 0.  The 3rd time through a for loop
loop.counter is 3 and loop.counter0 is 2.

If you want to add things try something like this:

{{ value|add:"2" }}

if value was 3 then 5 would be output.



On Jan 18, 1:53 pm, GD  wrote:
> Hi everyone,
>      Is there a way to do simple loop counter manipulation within the
> template? I.e something along the lines of:
>
> {% for x in a %}
>       loop number = {{forloop.counter +1}}
> {% endfor %}
>
> with the intention of
>
> 2
> 3
> 4
> 
>
> as output. I realise the above doesn't work, but is there any scope
> for this sort of thing within the templating language itself?
>
> Regards,
> G

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



forms, hidden fields

2011-01-18 Thread niall-oc
class VerificationForm(forms.Form):
domain = forms.CharField(max_length=100,
label='Domain name',
help_text='This is the domain name you chose
during the signup process',
)
mobile_number = forms.CharField(max_length=10,
label='Domain name',
help_text='This is the mobile number you chose
during the signup process',
)
verification_code = forms.CharField(max_length=10,
label='Domain name',
help_text='This is the verification code you
received in your SMS message',
)

There is a simple form.  My question is how do you set a field to be
hidden.

http://docs.djangoproject.com/en/1.1/topics/forms/#looping-over-the-form-s-fields

This document explains how you may check if a field is hidden, however
there seems to be no information on how to initially set the field to
be hidden. I've tried adding hidden=True and is_hidden=True to the
above class but to no avail.

Any help would be really appreciated

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.