From df99d01610f4f55bd507ff04b3c145d7135b5a0f Mon Sep 17 00:00:00 2001 From: sanj Date: Mon, 29 Nov 2010 14:02:19 +0100 Subject: [PATCH] added scriptbank --- itf/scriptbank/__init__.py | 0 itf/scriptbank/admin.py | 15 ++++++++ itf/scriptbank/models.py | 72 ++++++++++++++++++++++++++++++++++++++ itf/scriptbank/tests.py | 23 ++++++++++++ itf/scriptbank/views.py | 1 + itf/settings.py | 1 + requirements.txt | 1 + 7 files changed, 113 insertions(+) create mode 100644 itf/scriptbank/__init__.py create mode 100644 itf/scriptbank/admin.py create mode 100644 itf/scriptbank/models.py create mode 100644 itf/scriptbank/tests.py create mode 100644 itf/scriptbank/views.py diff --git a/itf/scriptbank/__init__.py b/itf/scriptbank/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/itf/scriptbank/admin.py b/itf/scriptbank/admin.py new file mode 100644 index 0000000..da6da18 --- /dev/null +++ b/itf/scriptbank/admin.py @@ -0,0 +1,15 @@ +from django.contrib import admin +from models import * +# from forms import ArticleForm + +class ScriptAdmin(admin.ModelAdmin): + search_fields = ('title', 'synopsis',), +# list_display = ('title', 'date',) + + +admin.site.register(Script, ScriptAdmin) +admin.site.register(LicenseAdapt) +admin.site.register(LicensePerform) +admin.site.register(Review) +admin.site.register(Downloader) + diff --git a/itf/scriptbank/models.py b/itf/scriptbank/models.py new file mode 100644 index 0000000..d736ba4 --- /dev/null +++ b/itf/scriptbank/models.py @@ -0,0 +1,72 @@ +from django.db import models +from django.contrib.auth.models import User +from tagging.fields import TagField + +GENRES = ( + ('Fiction', 'Fiction'), + ('Comedy', 'Comedy'), +) + +LANGUAGE_CHOICES = ( + ('en', 'English'), + ('hi', 'Hindi'), + ('ma', 'Marathi'), + ('be', 'Bengali'), +) + +class Script(models.Model): + user = models.ForeignKey(User) + title = models.CharField(max_length=255) + synopsis = models.TextField(blank=True) + no_characters = models.IntegerField(blank=True, help_text="Approximate number of characters") + no_of_women = models.IntegerField(blank=True, help_text="How many characters are women?") + tags = TagField(blank=True) + production_notes = models.TextField(blank=True, help_text="Additional production notes") + language = models.CharField(max_length=32, choices=LANGUAGE_CHOICES) + approx_duration = models.IntegerField(blank=True, help_text="Approximate time, in minutes") + is_partial = models.BooleanField(default=False, help_text="Check this if you are uploading only a partial script") + author = models.CharField(max_length=255) + contact = models.EmailField() + script = models.FileField(null=True, upload_to='upload/scripts/') + license_adapt = models.ForeignKey("LicensePerform", help_text="License for adaptation rights") + license_perform = models.ForeignKey("LicenseAdapt", help_text="License for performance rights") + + def __unicode__(self): + return self.title + +class License(models.Model): + letter = models.CharField(max_length=2) + name = models.CharField(max_length=255) + short_description = models.TextField() + readable_file = models.FileField(upload_to='upload/licenses/short/') + legal_file = models.FileField(upload_to='upload/licenses/legal/') + + def __unicode__(self): + return self.letter + ": " + self.name + + class Meta: + abstract = True + +class LicenseAdapt(License): + pass + +class LicensePerform(License): + pass + + +class Review(models.Model): + script = models.ForeignKey(Script) + reviewer = models.CharField(max_length=255) + reviewer_email = models.EmailField() + text = models.TextField() + + + +#this is to record who downloaded what play, etc. +class Downloader(models.Model): + script = models.ForeignKey(Script) + email = models.EmailField() + +##Make sure to add Comments to scripts + + diff --git a/itf/scriptbank/tests.py b/itf/scriptbank/tests.py new file mode 100644 index 0000000..2247054 --- /dev/null +++ b/itf/scriptbank/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these 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.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/itf/scriptbank/views.py b/itf/scriptbank/views.py new file mode 100644 index 0000000..60f00ef --- /dev/null +++ b/itf/scriptbank/views.py @@ -0,0 +1 @@ +# Create your views here. diff --git a/itf/settings.py b/itf/settings.py index 47b211f..f06702d 100644 --- a/itf/settings.py +++ b/itf/settings.py @@ -124,6 +124,7 @@ INSTALLED_APPS = ( 'itfcore', 'festival', 'erang_organised', + 'scriptbank', # 'solango', 'multilingual', # 'multilingual.flatpages', diff --git a/requirements.txt b/requirements.txt index 2f6a093..6f5a2ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ -e bzr+http://firefogg.org/dev/django_firefogg/#egg=django_firefogg -e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields sorl-thumbnail +django-tagging django-extensions django-debug-toolbar South