Skip to content

Commit

Permalink
Améliore l'interface d'administration pour les labels (#6513)
Browse files Browse the repository at this point in the history
* Ajoute l'auto-complétion du champ pour le slug à partir du nom du
  label
* Ajoute un lien pour accéder à la page listant les contenus ayant tel
  label
  • Loading branch information
philippemilink authored Jun 25, 2023
1 parent 5d13328 commit 4f60a67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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])

0 comments on commit 4f60a67

Please sign in to comment.