Create another blog post having the title TEST (all upper case)
Then you get an error:
MultipleObjectsReturned at /en/blog/post/test
get() returned more than one Post -- it returned 2!
Hints:
Before creating the blog post, you could query the database for blog posts having the same slug, not the same title, because Test and TEST both result in the same slug test. You could create form validator for this.
A slug must be unique in the database. You could make the field unique: slug = models.SlugField(default='', unique=True).
The application crashes under the following circumstances:
Test
, this works and I can access the post under http://localhost:8000/en/blog/post/testTEST
(all upper case)Then you get an error:
Hints:
Test
andTEST
both result in the same slugtest
. You could create form validator for this.unique
:slug = models.SlugField(default='', unique=True)
.