def clean_A6M1F6_F(self):
        data=self.cleaned_data['A6M1F6_F']
        if A6M1_mobile.objects.filter(A6M1F6=data).exists():
             raise forms.ValidationError(" already exixts")
        return data
i have this clean_field method in the form and given field is not
updatable....... whenever i tried to update the record with the form having
initial data as the record already inserted in the database this method
raise an exception while calling the is_valid() method



On Tue, Jan 22, 2013 at 7:39 PM, Sarfraz ahmad <sarfrazdja...@gmail.com>wrote:

> gusy i have form which has 5 fields.... i have defined a clean_field
> method which doesn't allow a duplicate entry in the database.
> bt when i tried to update the model instance while calling form.is_valid()
> method it calls the clean_field() method and returns error that entry
> already exists.....
>
>
>
> On Tue, Jan 22, 2013 at 2:57 AM, Mario Gudelj <mario.gud...@gmail.com>wrote:
>
>> Add required=False to the form field and it won't be validated.
>> On 22 Jan, 2013 2:30 AM, "Jonathan D. Baker" <
>> jonathandavidba...@gmail.com> wrote:
>>
>>>  Hi Sarfraz,
>>>
>>> If your form class inherits from ModelForm, you can use a subset of
>>> fields within your form per the following documentation:
>>> https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form
>>>
>>> If you're not inheriting from ModelForm, then it's a matter of
>>> configuring your model and form fields to allow null/blank. In this case,
>>> seeing your code would help provide more direction.
>>>
>>> Hope this helps,
>>> Jonathan
>>>
>>> On 01/21/2013 04:34 AM, Sarfraz ahmad wrote:
>>>
>>> Hello everyone,
>>>
>>>                      i m facing a problem while validating django
>>> form..... i have 5 form fields in a form.... and in the view i want to
>>> validate only three form fields which i need to update .......... tell me a
>>> solution if anyone have any
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/django-users/-/oZfMAZ8FWt4J.
>>> 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.
>>>
>>>
>>>
>>> --
>>> Software Developerhttps://github.com/jondbaker
>>> GPG: 1F6F3FFD
>>>
>>>  --
>>> 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.
>>>
>>  --
>> 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.
>>
>
>

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

Reply via email to