I exactly mean when user go to page for the first time, it seems that is_valid function call and error message display, but as you can see in code, it is not happen. I want that user only see empty field when coming to page, and after clicking save button, is valid function call. what can I do?
On Jun 1, 9:45 am, samira <sh_samir...@yahoo.com> wrote: > I exactly do like when I use Django 0.96. > for example this: > > Class AccountAdd(forms.Form): > accountNo = forms.IntegerField(min_value=1, required=True, > widget=forms.TextInput(attrs={'size':'10'})) > > def __init__(self, data=None, auto_id='id_%s', prefix=None, > initial=None, instance=None): > self.instance = None > super(AccountAdd, self).__init__(data, auto_id, prefix, > initial) > > and in views I use it as: > > if request.POST: > # If data was POSTed, we're trying to edit account > newData = request.POST.copy() > f = AccountAdd(newData) # Instantiate and load POST > data > # Check for errors. > if f.is_valid(): > # if data is valid, save data > account = f.save() > else: > f = AccountAdd() > > Do you know what is the problem? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---