Closed
Bug 599989
Opened 14 years ago
Closed 14 years ago
Fail gracefully when a duplicate title or slug is submitted
Categories
(support.mozilla.org :: Knowledge Base Software, task, P2)
support.mozilla.org
Knowledge Base Software
Tracking
(Not tracked)
VERIFIED
FIXED
2.3
People
(Reporter: erik, Assigned: rrosario)
Details
Trying to make a new document having the same title-locale or slug-locale pair as an existing one throws an IntegrityError. Do something nicer. I've introduced SlugCollision and TitleCollision in the redirect branch and will be raising them at appropriate times; we just have to catch them in the view.
Reporter | ||
Comment 1•14 years ago
|
||
We now have a wiki.views.json_view view that we could use to do real-time validation (thought we should still tolerate collisions that happen server-side). http://github.com/jsocol/kitsune/commit/f74eeabcb03038ee8ee737b1a171ba9bfade6f86
Reporter | ||
Comment 2•14 years ago
|
||
According to http://docs.djangoproject.com/en/dev/ref/models/instances/#validating-objects, the ModelForm validation should check the unique_together constraints. Why doesn't it?
Comment 3•14 years ago
|
||
Did you try updating your django version?
Comment 4•14 years ago
|
||
(In reply to comment #2) > According to > http://docs.djangoproject.com/en/dev/ref/models/instances/#validating-objects, > the ModelForm validation should check the unique_together constraints. Why > doesn't it? It totally should. Are we overriding a method without calling super()?
Reporter | ||
Comment 5•14 years ago
|
||
Maybe clean()?
Reporter | ||
Comment 6•14 years ago
|
||
The example in the docs doesn't call super(), but it wouldn't be the first time the docs were wrong.
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → rrosario
Assignee | ||
Comment 7•14 years ago
|
||
Landed: https://github.com/jsocol/kitsune/commit/953efe2d4b61082979154d7222ee997d80dac9b4 There is a separate issue still, where title and slug uniqueness with locale is case-insensitive, but the check for creating redirects automatically is case-sensitive. I'll file that in a separate bug.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 8•14 years ago
|
||
Verified duplicate article names and slugs give error message
Status: RESOLVED → VERIFIED
Comment 9•14 years ago
|
||
Verified duplicate article names and slugs give error message
You need to log in
before you can comment on or make changes to this bug.
Description
•