Hi everyone,

I have a model 'Person' in my application as follows:

class Person(models.Model):
        name = models.CharField(max_length = 100)
        address = models.CharField(max_length = 800)
        phone = models.CharField(max_length = 15)

Next, I have created a modelform,

class PersonForm(ModelForm):
        address = forms.CharField(widget = forms.Textarea(attrs = {'rows': 3,
'cols':30 }))
        class Meta:
                model = Person



views.py
********

def getInfo(request):
       person = Person()
       if request.method == POST:
              pform = PersonForm(request.POST)
              if pform.is_valid():
                    pform.save()
              else:
                    pform = PersonForm(instance = person)
       else:
              pform = PersonForm()
      return render_to_response("person.html",{"form":pform})


My problem is that when pform.is_valid() is 'false', I want to reprint
the form with user submitted data and also with error messages for
corresponding fields with errors. But now a blank form is being
rendered.

Can anybody give suggestions?

Thanks.....

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

Reply via email to