invoked get_absolute_url() on List model to achieve DRY urls in views

This commit is contained in:
Disco DeDisco
2026-01-19 19:25:04 -05:00
parent 0b0ae6d5b0
commit 5af5ff55fa
3 changed files with 10 additions and 3 deletions

View File

@@ -1,7 +1,10 @@
from django.db import models
from django.urls import reverse
class List(models.Model):
pass
def get_absolute_url(self):
return reverse("view_list", args=[self.id])
class Item(models.Model):
text = models.TextField(default='')