Using Translated Slugs In Views — Django-parler 2.3 Documentation
django-parler stable
- Quick start guide
- Configuration options
- Template tags
- Performance guidelines
- Advanced usage patterns
- Translations without fallback languages
- Using translated slugs in views
- Making existing fields translatable
- Adding translated fields to an existing model
- Integration with django-mptt
- Integration with django-polymorphic
- Integration with django-guardian
- Integration with django-rest-framework
- Multi-site support
- Disabling caching
- Parler on more sites with same cache
- Constructing the translations model manually
- Customizing language settings
- Django compatibility
- Background
- API documentation
- Changelog
- Docs »
- Advanced usage patterns »
- Using translated slugs in views
- Edit on GitHub
To handle translatable slugs in the DetailView, the TranslatableSlugMixin can be used to make this work smoothly. For example:
class ArticleDetailView(TranslatableSlugMixin, DetailView): model = Article template_name = 'article/details.html'The TranslatableSlugMixin makes sure that:
- The object is fetched in the proper translation.
- The slug field is read from the translation model, instead of the shared model.
- Fallback languages are handled.
- Objects are not accidentally displayed in their fallback slugs, but redirect to the translated slug.
Từ khóa » đan Slug
-
What Is A "slug" In Django? - Stack Overflow
-
Django Slug Tutorial
-
Add The Slug Field Inside Django Model - GeeksforGeeks
-
Django-slug-preview - PyPI
-
43 - Slugs In Dynamic Urls - Python & Django 3.2 Tutorial Series
-
Slug Field Is Accepting Whitespace When Entered Through Django Shell.
-
URL Dispatcher - Django Documentation
-
Marcanuy/django-slugs-example-app: A Basic App To Show ... - GitHub
-
Changing Page Settings — Django Cms 3.4.7 Documentation
-
Slug In Django | Delft Stack
-
12. How To Use Slug Field With Django For More Readability?
-
Installation — Django-primary-slug V0.1.1b1 Documentation
-
Dan Slug | Facebook