#5819: FlatPage model field url is not unique
--------------------------------+-------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: nobody
Status: new | Component: Contrib apps
Version: SVN | Resolution:
Keywords: flatpages | Stage: Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
--------------------------------+-------------------------------------------
Changes (by arien <[EMAIL PROTECTED]>):
* needs_better_patch: 1 => 0
* has_patch: 1 => 0
Comment:
You cannot have a unique constraint across tables.
You could prevent creating duplicates by checking what combinations are
"taken" before saving: you raise an exception if the FlatPage you're about
to save has one or more Sites that are already used by another FlatPage
(i.e. one with a different id) with the same URL (path, really). But
you'd have to do that in a transaction, and since not all databases used
with Django are guaranteed to have those...
Changing
[http://code.djangoproject.com/browser/django/trunk/django/contrib/flatpages/views.py
the view] to use get_list_or_404 (and picking one of the results) instead
of get_object_or_404 isn't really an option either, so I think punting was
probably the right decision.
--
Ticket URL: <http://code.djangoproject.com/ticket/5819#comment:5>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django 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/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---