Created
January 3, 2018 16:27
-
-
Save mammuth/75c50f03648b1d5a8e4741fc317c4216 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# models.py | |
class Job(models.Model): | |
slug = models.SlugField(max_length=60) | |
@models.permalink | |
def get_absolute_url(self): | |
return 'career:job-detail', (self.pk, self.slug) | |
# urls.py | |
path('<int:id>/<slug:slug>/', JobDetailView.as_view(), name='job') | |
# admin.py | |
prepopulated_fields = {'slug': ('title',)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment