Author: jtauber
Date: Sat Sep 13 02:51:04 2008
New Revision: 882
Modified:
trunk/pinax/local_apps/projects/forms.py
trunk/pinax/local_apps/tribes/forms.py
Log:
check of existing slug/name of tribes and projects is now case-insensitve
Modified: trunk/pinax/local_apps/projects/forms.py
==============================================================================
--- trunk/pinax/local_apps/projects/forms.py (original)
+++ trunk/pinax/local_apps/projects/forms.py Sat Sep 13 02:51:04 2008
@@ -12,12 +12,12 @@
error_message = _("This value must contain only letters, numbers
and underscores."))
def clean_slug(self):
- if Project.objects.filter(slug=self.cleaned_data["slug"]).count()
> 0:
+ if
Project.objects.filter(slug__iexact=self.cleaned_data["slug"]).count() > 0:
raise forms.ValidationError(_("A project already exists with
that slug."))
return self.cleaned_data["slug"]
def clean_name(self):
- if Project.objects.filter(name=self.cleaned_data["name"]).count()
> 0:
+ if
Project.objects.filter(name__iexact=self.cleaned_data["name"]).count() > 0:
raise forms.ValidationError(_("A project already exists with
that name."))
return self.cleaned_data["name"]
@@ -31,7 +31,7 @@
class ProjectUpdateForm(forms.ModelForm):
def clean_name(self):
- if Project.objects.filter(name=self.cleaned_data["name"]).count()
> 0:
+ if
Project.objects.filter(name__iexact=self.cleaned_data["name"]).count() > 0:
if self.cleaned_data["name"] == self.instance.name:
pass # same instance
else:
Modified: trunk/pinax/local_apps/tribes/forms.py
==============================================================================
--- trunk/pinax/local_apps/tribes/forms.py (original)
+++ trunk/pinax/local_apps/tribes/forms.py Sat Sep 13 02:51:04 2008
@@ -13,12 +13,12 @@
reserved_slugs = ["your_tribes"]
if self.cleaned_data["slug"] in reserved_slugs:
raise forms.ValidationError(_("The slug you've chosen is
reserved for internal use."))
- if Tribe.objects.filter(slug=self.cleaned_data["slug"]).count() >
0:
+ if
Tribe.objects.filter(slug__iexact=self.cleaned_data["slug"]).count() > 0:
raise forms.ValidationError(_("A tribe already exists with
that slug."))
return self.cleaned_data["slug"]
def clean_name(self):
- if Tribe.objects.filter(name=self.cleaned_data["name"]).count() >
0:
+ if
Tribe.objects.filter(name__iexact=self.cleaned_data["name"]).count() > 0:
raise forms.ValidationError(_("A tribe already exists with
that name."))
return self.cleaned_data["name"]
@@ -32,7 +32,7 @@
class TribeUpdateForm(forms.ModelForm):
def clean_name(self):
- if Tribe.objects.filter(name=self.cleaned_data["name"]).count() >
0:
+ if
Tribe.objects.filter(name__iexact=self.cleaned_data["name"]).count() > 0:
if self.cleaned_data["name"] == self.instance.name:
pass # same instance
else:
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---