hi gang.... i have a subclass on my form as follows:

class NewUrl (forms.Field):
    def clean(self, value):
        rs=WebPage.objects.filter(url_slug=value)
        thislength=str(len(value))
        if rs.count()!=0:
            raise forms.ValidationError ('This URL is already in
use.')
        if not value:
            raise forms.ValidationError ('Please enter a url such as /
my-page/')
        if len(value)>254:
            raise forms.ValidationError ('254 Characters Max.  The
current length is %s'  % thislength)
        return value


This checks to see if a url being added to the system is unique and it
works great.  My question is this.  If i load data to a form
(initial=) with an initial url, how can i check to see if the url
going back on an update is unique AND not for the current record?



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