defined Meta ordering of the Item() model in apps.dashboard.models; Item() also now returns a __str__ result; in .forms, defined a specific use-case of is_valid() method; a pair of new UTs in .tests.test_models help confirm str representation and list order of items; .test_forms now ensures the .is-invalid bootstrap class is tested as a css class attr; migrations run; full UT & FT suite back to passing state (tho a refactor of flimsy form customizations is desperately needed)
This commit is contained in:
@@ -4,11 +4,15 @@ from django.urls import reverse
|
||||
class List(models.Model):
|
||||
def get_absolute_url(self):
|
||||
return reverse("view_list", args=[self.id])
|
||||
|
||||
|
||||
class Item(models.Model):
|
||||
text = models.TextField(default="")
|
||||
list = models.ForeignKey(List, default=None, on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
ordering = ("id",)
|
||||
unique_together = ("list", "text")
|
||||
|
||||
def __str__(self):
|
||||
return self.text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user