From: Jérôme Benoit Date: Wed, 30 Oct 2013 23:40:54 +0000 (+0100) Subject: The comicsporn django app : the beginning. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c8070854bc39b679b53502dd08eb9b8e33477e42;p=webcomics.git The comicsporn django app : the beginning. Signed-off-by: Jérôme Benoit --- diff --git a/comicsporn/__init__.py b/comicsporn/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/comicsporn/__init__.pyc b/comicsporn/__init__.pyc new file mode 100644 index 0000000..6559fb9 Binary files /dev/null and b/comicsporn/__init__.pyc differ diff --git a/comicsporn/models.py b/comicsporn/models.py new file mode 100644 index 0000000..8ccfd9d --- /dev/null +++ b/comicsporn/models.py @@ -0,0 +1,38 @@ +from django.db import models + +# Create your models here. + +# A very basic data model to begin with +# Create sensible default option, test the authentification framework, ensure +# pertinence of the comics building way : page by page, vignette by vignette, etc. offer +# multiple way as much as much possible, test upload to PDF file outisde the DB... + +class User(models.Model): + first_name = models.CharField(max_length=50) + last_name = models.CharField(max_length=50) + # Not sure about this two, django should offer login/pass and session + #login = models.CharField(max_length=15) + #password = models.CharField(max_length=15) + email = models.EmailField() + headshot = models.ImageField(upload_to='user_headshots') + is_author = models.BooleanField() + #num_awards = models.IntegerField() + + +class Comics_page(models.Model): + # Not sure about vignette by vignette view or page by page ... let's start page by page + page_number = models.IntegerField() + page_content = models.ImageField(upload_to='comics_pages') + upload_date = models.DateField() + page_authors = models.ManyToManyField(User) + +class Comics(Comics_page): + title = models.CharField(max_length=300) + rating = models.FloatField() + authors = models.ManyToManyField(User) + publication_date = models.DateField() + # Change the related name to a more appropriate name + fragment_comics = models.ManyToManyField(Comics_page, related_name="%(app_label)s_%(class)s_related") + full_comics = models.ImageField(upload_to='comics_full') + full_comics_upload_date = models.DateField() + #publisher = models.ForeignKey(User) diff --git a/comicsporn/models.pyc b/comicsporn/models.pyc new file mode 100644 index 0000000..af24cbc Binary files /dev/null and b/comicsporn/models.pyc differ diff --git a/comicsporn/tests.py b/comicsporn/tests.py new file mode 100644 index 0000000..501deb7 --- /dev/null +++ b/comicsporn/tests.py @@ -0,0 +1,16 @@ +""" +This file demonstrates writing tests using the unittest module. These will pass +when you run "manage.py test". + +Replace this with more appropriate tests for your application. +""" + +from django.test import TestCase + + +class SimpleTest(TestCase): + def test_basic_addition(self): + """ + Tests that 1 + 1 always equals 2. + """ + self.assertEqual(1 + 1, 2) diff --git a/comicsporn/views.py b/comicsporn/views.py new file mode 100644 index 0000000..60f00ef --- /dev/null +++ b/comicsporn/views.py @@ -0,0 +1 @@ +# Create your views here. diff --git a/settings.py b/settings.py index e2dd4a0..cc21cbb 100644 --- a/settings.py +++ b/settings.py @@ -128,6 +128,7 @@ INSTALLED_APPS = ( 'django.contrib.admin', # Uncomment the next line to enable admin documentation: 'django.contrib.admindocs', + 'comicsporn', ) # A sample logging configuration. The only tangible logging