summaryrefslogtreecommitdiff
path: root/tbc
diff options
context:
space:
mode:
Diffstat (limited to 'tbc')
-rw-r--r--tbc/models.py7
-rwxr-xr-xtbc/views.py5
2 files changed, 10 insertions, 2 deletions
diff --git a/tbc/models.py b/tbc/models.py
index 74419e4..e2e6940 100644
--- a/tbc/models.py
+++ b/tbc/models.py
@@ -2,6 +2,7 @@ from django.db import models
from django.contrib.auth.models import User
from PythonTBC import settings
from django.contrib.admin.models import LogEntry
+from local import sitemap_path
CATEGORY = (("fluid mechanics", "Fluid Mechanics"),
@@ -56,7 +57,8 @@ BOOK_PREFERENCE = (("book1","1st Book"),
def get_notebook_dir(instance, filename):
- return '%s/%s' % (instance.book.title.replace(' ', '_'), filename.replace(' ', '_'))
+ book_dir = instance.book.title.replace(' ', '_')+'_by_'+instance.book.author.replace(' ','_')
+ return '%s/%s' % (book_dir, filename.replace(' ', '_'))
def get_image_dir(instance, filename):
@@ -104,6 +106,7 @@ class Book(models.Model):
def __unicode__(self):
name = self.title or 'Book'
return '%s'%(name)
+
class Chapters(models.Model):
name = models.CharField(max_length=200)
@@ -113,6 +116,8 @@ class Chapters(models.Model):
def __unicode__(self):
name = self.name or 'Chapter'
return '%s'%(name)
+ def get_absolute_url(self):
+ return sitemap_path+str(self.notebook)
class ScreenShots(models.Model):
diff --git a/tbc/views.py b/tbc/views.py
index 9d6d4a3..fe31941 100755
--- a/tbc/views.py
+++ b/tbc/views.py
@@ -892,8 +892,11 @@ def SubmitCode(request):
counter += 1
curr_proposal.status = "codes submitted"
curr_proposal.save()
+ subject = "Python-TBC: Book & Code Updated"
+ message = """Hi """+curr_book.reviewer.name+""",\nA book & code has been updated on the Python TBC interface.\n Details of the book & contributor:\n Contributor: """+curr_book.contributor.user.first_name+""" """+curr_book.contributor.user.last_name+"""\nBook Title"""+curr_book.title+"""\nAuthor: """+curr_book.title+"""\nAuthor: """+curr_book.author+"""\n Publisher: """+curr_book.publisher_place+"""\nISBN: """+curr_book.isbn+"""\nFollow the link to riview the book:\nhttp://tbc-python.fosse.in/book-review/"""+str(curr_book.id)
add_log(user, curr_book, CHANGE, 'Codes & Screenshots Resubmitted',
curr_proposal.id)
+ email_send(curr_book.reviewer.email, subject, message)
return HttpResponseRedirect('/?bookupdate=done')
if request.method == 'POST':
for i in range(1, curr_book.no_chapters+1):
@@ -916,7 +919,7 @@ def SubmitCode(request):
curr_proposal.status = "codes submitted"
curr_proposal.save()
subject = "Python-TBC: Book Submission"
- message = """Hi """+curr_book.reviewer.name+""",\nA book has been submitted on the Python TBC interface.\n Detailf othe book & contributor:\n Contributor: """+curr_book.contributor.user.first_name+""" """+curr_book.contributor.user.last_name+"""\nBook Title"""+curr_book.title+"""\nAuthor: """+curr_book.title+"""\nAuthor: """+curr_book.author+"""\n Publisher: """+curr_book.publisher_place+"""\nISBN: """+curr_book.isbn+"""\nFollow the link to riview the book:\nhttp://tbc-python.fosse.in/book-review/"""+str(curr_book.id)
+ message = """Hi """+curr_book.reviewer.name+""",\nA book has been submitted on the Python TBC interface.\n Details of the book & contributor:\n Contributor: """+curr_book.contributor.user.first_name+""" """+curr_book.contributor.user.last_name+"""\nBook Title"""+curr_book.title+"""\nAuthor: """+curr_book.title+"""\nAuthor: """+curr_book.author+"""\n Publisher: """+curr_book.publisher_place+"""\nISBN: """+curr_book.isbn+"""\nFollow the link to riview the book:\nhttp://tbc-python.fosse.in/book-review/"""+str(curr_book.id)
log_chat = subject + '\n' + 'Book ' + curr_book.title + \
' has been submitted on the Python TBC interface.'
add_log(user, curr_book, CHANGE, 'Chapters and Screenshots added',