From ad232020d57d2c77dfd5400dc4a8290b484c8ba2 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Sun, 14 Jul 2024 15:30:27 -0500 Subject: Initial commit --- journal/api/models.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 journal/api/models.py (limited to 'journal/api/models.py') diff --git a/journal/api/models.py b/journal/api/models.py new file mode 100644 index 0000000..fb5dac4 --- /dev/null +++ b/journal/api/models.py @@ -0,0 +1,26 @@ +from django.db import models + +class Author(models.Model): + author = models.CharField(max_length=1024) + + def __str__(self): + return self.author + + +class Source(models.Model): + url = models.CharField(max_length=1024) + title = models.CharField(max_length=1024) + author = models.ForeignKey(Author, on_delete=models.CASCADE) + + def __str__(self): + return f"{self.author} -{self.title}" + + +class Entry(models.Model): + created = models.DateField() + html_text = models.TextField() + source = models.ForeignKey( + Source, on_delete=models.CASCADE, related_name="entries") + + def __str__(self): + return f"{self.source} - {self.created}" -- cgit v1.2.3