added scriptbank

This commit is contained in:
sanj 2010-11-29 14:02:19 +01:00
parent 87f05437da
commit df99d01610
7 changed files with 113 additions and 0 deletions

View File

15
itf/scriptbank/admin.py Normal file
View File

@ -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)

72
itf/scriptbank/models.py Normal file
View File

@ -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

23
itf/scriptbank/tests.py Normal file
View File

@ -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
"""}

1
itf/scriptbank/views.py Normal file
View File

@ -0,0 +1 @@
# Create your views here.

View File

@ -124,6 +124,7 @@ INSTALLED_APPS = (
'itfcore', 'itfcore',
'festival', 'festival',
'erang_organised', 'erang_organised',
'scriptbank',
# 'solango', # 'solango',
'multilingual', 'multilingual',
# 'multilingual.flatpages', # 'multilingual.flatpages',

View File

@ -5,6 +5,7 @@
-e bzr+http://firefogg.org/dev/django_firefogg/#egg=django_firefogg -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 -e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields
sorl-thumbnail sorl-thumbnail
django-tagging
django-extensions django-extensions
django-debug-toolbar django-debug-toolbar
South South