brack3t/django-braces — pull request #61 by folz (2013-07-30 02:35:55+00:00)
Title: Canonical slug detail mixin, with docs and passing tests.

This pull request adds a mixin that enforces a canonical slug in the url, while still using the pk for object lookup. If the url slug argument isn't equal to the canonical slug, the mixin redirects to the canonical slug. Otherwise, the page load continues as normal.

Benefits: prevent duplicate content SEO penalty if a non-canonical link is somehow indexed by a search engine.

Example (also in the docs):

```
Article: {pk: 1, slug: 'hello-world'}

>>> HEAD http://127.0.0.1:8000/article/1-hello-world
HTTP/1.1 200 OK

>>> HEAD http://127.0.0.1:8000/article/1-goodnight-moon
HTTP/1.1 301 Moved Permanently
Location: http://127.0.0.1:8000/article/1-hello-world
```

I've tried to document and test this mixin in the style of the existing mixins. Let me know if this PR is acceptable or if I should make additional changes.