can now also order topics

This commit is contained in:
CDaut 2022-06-18 12:18:44 +02:00 committed by CDaut
parent ead8a3a2ef
commit eca6e5d716
8 changed files with 103 additions and 13 deletions

View file

@ -2,7 +2,11 @@ from django.db import models
class Tag(models.Model):
name = models.CharField(max_length=255)
def __str__(self) -> str:
return str(self.name)
name = models.CharField(max_length=255, unique=True)
class Topic(models.Model):
@ -10,7 +14,7 @@ class Topic(models.Model):
def __str__(self) -> str:
return str(self.name)
name = models.CharField(max_length=255)
name = models.CharField(max_length=255, unique=True)
numbered = models.BooleanField(default=False)
rootTopic = models.ForeignKey('self', blank=True, null=True, on_delete=models.CASCADE)
@ -22,7 +26,7 @@ class Blogpost(models.Model):
created = models.DateTimeField(auto_now_add=True)
last_modified = models.DateTimeField(auto_now=True)
title = models.CharField(max_length=255)
title = models.CharField(max_length=255, unique=True)
tags = models.ManyToManyField(Tag)
topic = models.ForeignKey(Topic, blank=True, null=True, on_delete=models.CASCADE)
mdfile = models.CharField(max_length=255)