| 1 | from django.db import models |
| 2 | |
| 3 | # Create your models here. |
| 4 | |
| 5 | # A very basic data model to begin with |
| 6 | # Create sensible default option, test the authentification framework, ensure |
| 7 | # pertinence of the comics building way : page by page, vignette by vignette, etc. offer |
| 8 | # multiple way as much as much possible, test upload to PDF file outisde the DB... |
| 9 | |
| 10 | class User(models.Model): |
| 11 | first_name = models.CharField(max_length=50) |
| 12 | last_name = models.CharField(max_length=50) |
| 13 | # Not sure about this two, django should offer login/pass and session |
| 14 | #login = models.CharField(max_length=15) |
| 15 | #password = models.CharField(max_length=15) |
| 16 | email = models.EmailField() |
| 17 | headshot = models.ImageField(upload_to='user_headshots') |
| 18 | is_author = models.BooleanField() |
| 19 | #num_awards = models.IntegerField() |
| 20 | |
| 21 | |
| 22 | class Comics_page(models.Model): |
| 23 | # Not sure about vignette by vignette view or page by page ... let's start page by page |
| 24 | page_number = models.IntegerField() |
| 25 | page_content = models.ImageField(upload_to='comics_pages') |
| 26 | upload_date = models.DateField() |
| 27 | page_authors = models.ManyToManyField(User) |
| 28 | |
| 29 | class Comics(Comics_page): |
| 30 | title = models.CharField(max_length=300) |
| 31 | rating = models.FloatField() |
| 32 | authors = models.ManyToManyField(User) |
| 33 | publication_date = models.DateField() |
| 34 | # Change the related name to a more appropriate name |
| 35 | fragment_comics = models.ManyToManyField(Comics_page, related_name="%(app_label)s_%(class)s_related") |
| 36 | full_comics = models.ImageField(upload_to='comics_full') |
| 37 | full_comics_upload_date = models.DateField() |
| 38 | #publisher = models.ForeignKey(User) |