diff options
author | hardythe1 | 2014-07-14 16:31:00 +0530 |
---|---|---|
committer | hardythe1 | 2014-07-14 16:31:00 +0530 |
commit | 686b7c2e0805d50729e1e71afdff0796f1273dcc (patch) | |
tree | 0f0ee654aaa9422a7345a19c5ea1c2a681376b18 /tbc | |
parent | 238dad8a15639de450ab63738973240b151f1171 (diff) | |
download | Python-TBC-Interface-686b7c2e0805d50729e1e71afdff0796f1273dcc.tar.gz Python-TBC-Interface-686b7c2e0805d50729e1e71afdff0796f1273dcc.tar.bz2 Python-TBC-Interface-686b7c2e0805d50729e1e71afdff0796f1273dcc.zip |
changes for sample notebook submission
Diffstat (limited to 'tbc')
-rw-r--r-- | tbc/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tbc/models.py b/tbc/models.py index b063274..f9e721e 100644 --- a/tbc/models.py +++ b/tbc/models.py @@ -44,6 +44,10 @@ PROPOSAL_STATUS = (("pending","Pending"), ("book completed","Book Completed"), ("rejected","Rejected")) +BOOK_PREFERENCE = (("book1","1st Book"), + ("book2","2nd Book"), + ("book3","3rd Book")) + def get_notebook_dir(instance, filename): return '%s/%s/%s' % (instance.book.contributor, instance.book.title.replace(' ', '_'), filename.replace(' ', '_')) @@ -53,6 +57,10 @@ def get_image_dir(instance, filename): return '%s/%s/screenshots/%s' % (instance.book.contributor, instance.book.title.replace(' ', '_'), filename.replace(' ', '_')) +def get_sample_dir(instance, filename): + user_name = instance.user.user.first_name+instance.user.user.last_name + return 'sample_notebooks/%s/%s' % (user_name, filename.replace(' ', '_')) + class Profile(models.Model): user = models.ForeignKey(User) about = models.CharField(max_length=256) @@ -132,3 +140,9 @@ class Proposal(models.Model): def __unicode__(self): user = self.user.user.username or 'User' return '%s'%(user) + + +class SampleNotebook(models.Model): + proposal = models.ForeignKey(Proposal) + notebook = models.FileField(upload_to=get_sample_dir) + book_preference = models.CharField(max_length=30, choices=BOOK_PREFERENCE) |