73 lines
2.2 KiB
Python
73 lines
2.2 KiB
Python
|
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
|
||
|
|
||
|
|