issue-tracker/forkosissuetracker/issuetracker_app/models.py
Janik Haag 9e0b8e5699 Initial code dump
This is the initial code dump from Janik.
I obtained express permission to license it under MIT, see the next
commit.
2024-10-20 16:20:48 +02:00

28 lines
873 B
Python

from django.db import models
from simple_history.models import HistoricalRecords
from django.contrib.auth.models import User
class Issue(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE)
title = models.CharField(max_length=128)
description = models.CharField(max_length=2048)
last_modified = models.DateTimeField(auto_now=True)
history = HistoricalRecords()
def get_absolute_url(self):
return f"/issues/{self.id}"
def __str__(self):
return f"{self.title}"
class Meta:
ordering = ["last_modified"]
class Comment(models.Model):
issue = models.ForeignKey(Issue, on_delete=models.CASCADE)
author = models.ForeignKey(User, on_delete=models.CASCADE)
body = models.CharField(max_length=2048)
last_modified = models.DateTimeField(auto_now=True)
history = HistoricalRecords()