From dca37168a8dfdc61e950e746dd4f9fb0aca06eac Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Mon, 19 May 2014 18:17:25 +0530 Subject: adding new models in the admin interface --- tbc/admin.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tbc') diff --git a/tbc/admin.py b/tbc/admin.py index 959ce84..2a82b76 100644 --- a/tbc/admin.py +++ b/tbc/admin.py @@ -6,3 +6,5 @@ admin.site.register(Book) admin.site.register(Reviewer) admin.site.register(Chapters) admin.site.register(ScreenShots) +admin.site.register(TempBook) +admin.site.register(Proposal) -- cgit From e12c15d9049b1f991d072732949963b5a0d32c20 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Mon, 19 May 2014 18:18:12 +0530 Subject: editing place holders --- tbc/forms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tbc') diff --git a/tbc/forms.py b/tbc/forms.py index 8fc6e22..327c32a 100644 --- a/tbc/forms.py +++ b/tbc/forms.py @@ -59,7 +59,7 @@ class BookForm(forms.ModelForm): self.fields['isbn'].label = "ISBN No." self.fields['edition'].label = "Book Edition" self.fields['year_of_pub'].label = "Year of Publication" - self.fields['no_chapters'].label = "Number of Chapter" + self.fields['no_chapters'].label = "Number of Chapters" class Meta: model = Book exclude = ('contributor', 'approved', 'reviewer') @@ -70,5 +70,5 @@ class BookForm(forms.ModelForm): 'isbn':forms.TextInput(attrs={'placeholder':'Valid ISBN no. of the Book'}), 'edition':forms.TextInput(attrs={'placeholder':'Edition of the Book'}), 'year_of_pub':forms.TextInput(attrs={'placeholder':'Year when the Book was published'}), - 'no_chapters':forms.TextInput(attrs={'placeholder':'Total number of chapters in the Book'}), + 'no_chapters':forms.TextInput(attrs={'placeholder':'Total number of chapters in the Book (only include chapters that have solved examples)'}), } -- cgit From f4bcb096cbc4176494987bf167b05130af0701e9 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Mon, 19 May 2014 18:18:39 +0530 Subject: adding new models for storing proposals --- tbc/models.py | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'tbc') diff --git a/tbc/models.py b/tbc/models.py index 76c9dc6..b063274 100644 --- a/tbc/models.py +++ b/tbc/models.py @@ -37,7 +37,12 @@ ABOUT_PROJ = (("pythontbc website", "Python TBC Website"), ("mailing list", "Through Mailing List"), ("posters in college", "Through Posters in College"), ("others", "Others")) - + +PROPOSAL_STATUS = (("pending","Pending"), + ("samples","Samples"), + ("book alloted","Book Alloted"), + ("book completed","Book Completed"), + ("rejected","Rejected")) def get_notebook_dir(instance, filename): @@ -49,7 +54,6 @@ def get_image_dir(instance, filename): class Profile(models.Model): - """Model to store profile of a user.""" user = models.ForeignKey(User) about = models.CharField(max_length=256) insti_org = models.CharField(max_length=128) @@ -72,7 +76,6 @@ class Reviewer(models.Model): return '%s'%(name) class Book(models.Model): - """Model to store the book details""" title = models.CharField(max_length=500) author = models.CharField(max_length=300) category = models.CharField(max_length=32, choices=CATEGORY) @@ -104,3 +107,28 @@ class ScreenShots(models.Model): def __unicode__(self): name = self.caption or 'ScreenShots' return '%s'%(name) + + +class TempBook(models.Model): + title = models.CharField(max_length=500) + author = models.CharField(max_length=300) + category = models.CharField(max_length=32, choices=CATEGORY) + publisher_place = models.CharField(max_length=150) + isbn = models.CharField(max_length=50) + edition = models.CharField(max_length=15) + year_of_pub = models.CharField(max_length=4) + no_chapters = models.IntegerField(max_length=2) + def __unicode__(self): + name = self.title or 'Book' + return '%s'%(name) + + +class Proposal(models.Model): + user = models.ForeignKey(Profile) + textbooks = models.ManyToManyField(TempBook, related_name="proposed_textbooks") + accepted = models.ForeignKey(Book, related_name="approved_textbook", blank=True,null=True) + status = models.CharField(max_length=20, default="Pending", choices=PROPOSAL_STATUS) + remarks = models.CharField(max_length=1000) + def __unicode__(self): + user = self.user.user.username or 'User' + return '%s'%(user) -- cgit From efa6aaff8170869550f4af6b53846f978b04058d Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Mon, 19 May 2014 18:18:56 +0530 Subject: adding link to submit proposal --- tbc/templates/base.html | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tbc') diff --git a/tbc/templates/base.html b/tbc/templates/base.html index 5f19882..dca79d6 100755 --- a/tbc/templates/base.html +++ b/tbc/templates/base.html @@ -94,6 +94,7 @@