I tried this by making a separate form and adding clean_field()
method.

class MyDataForm(forms.Form):
    url=forms.URLField()

    def __init__(self,formdata,request,*args,**kwargs):
        forms.Form.__init__(self,formdata, *args, **kwargs)
        self.user=request.user
    def clean_url(self):
        try:
            url=self.cleaned_data['url']

        except KeyError:
            raise forms.ValidationError('you must give a url')

        #user_given_urls=how to do this??
        if url in user_given_urls:
            raise  forms.ValidationError('duplicate url')

        return url

I couldn't figure out how to get the user_given_urls through filter
method on MyModel..can anybody help?

thanks
mark

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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