Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Améliore l'interface d'administration pour les labels #6513

Merged
merged 1 commit into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions zds/tutorialv2/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class GoalAdmin(admin.ModelAdmin):
class LabelAdmin(admin.ModelAdmin):
list_display = ["name", "description"]
ordering = ["name"]
prepopulated_fields = {"slug": ("name",)}


admin.site.register(PublishableContent, PublishableContentAdmin)
Expand Down
4 changes: 4 additions & 0 deletions zds/tutorialv2/models/labels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.db import models
from django.urls import reverse


class Label(models.Model):
Expand All @@ -21,3 +22,6 @@ class Meta:

def __str__(self):
return self.name

def get_absolute_url(self):
return reverse("content:view-labels", args=[self.slug])