Re: Django FOrms
Hi, u ve not inserted comma after a first entry in the tuple NO_OF_HRS
On Sat, Mar 24, 2012 at 3:11 AM, prem <prem1pre@gmail.com> wrote:
I'm using Django forms and need to create a list box.
What would be the equivalent of listbox in Django form fields?
Here is my code snippet,
Models.py
class Volunteer(models.Model):
NO_OF_HRS = (('1','1') ('2','2'))
datecreated = models.DateTimeField()
volposition = models.CharField(max_length=300)
roledesc = models.CharField(max_length=300)
Duration = models.CharField(choices=NO_OF_HRS,max_length=1)**
forms.py
class VolunteerForm(forms.ModelForm)
datecreated = forms.DateField(label=u'Creation Date')
volposition = forms.CharField(label=u'Position Name',
max_length=300)
roledesc = forms.roledesc(label=u'Role
description',max_length=5000)
Duration =
forms.CharField(widget=forms.select(choices=NO_OF_HRS),max_length=2)
When I try to run, I get the following error,
NO_OF_HRS is not defined
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home