I have a public-facing form where registered users can submit clubs.
Later, I access the data by slug, using a generic object_detail view.

My problem is that someone can input a club that's already there.
Besides polluting the database, it breaks when they try to access the
club's page (GET returns 2).

So, how can I have newforms check for a dupe before saving the form
and (hopefully) return an error message if there is a dupe? Here's the
newforms part I have:

if request.method == 'POST':
        submission = request.POST.copy()
        submission['slug'] = slugify(submission['name'])
        form = ClubFormClass(submission)
        if form.is_valid():
                        form.save()
                     return HttpResponseRedirect('/thankyou/')
      else:
                     form = ClubFormClass()


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to