From 475a7b16aa8c24ff2d42e71a84db32949c0f4cf8 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Fri, 14 Nov 2014 17:18:08 +0530 Subject: Screenshots will be linked to corresponding chapter Any new chapters and screenshots submitted will be linked. --- tbc/models.py | 1 + tbc/templates/tbc/book-details.html | 6 +++++- tbc/templates/tbc/book-review-details.html | 6 +++++- tbc/templates/tbc/update-code.html | 27 ++++++++++++++++++++++----- tbc/templates/tbc/upload-content.html | 14 +++++++++++++- tbc/views.py | 14 ++++++++++++++ 6 files changed, 60 insertions(+), 8 deletions(-) diff --git a/tbc/models.py b/tbc/models.py index 67a6d09..bd06c93 100644 --- a/tbc/models.py +++ b/tbc/models.py @@ -109,6 +109,7 @@ class Chapters(models.Model): name = models.CharField(max_length=200) notebook = models.FileField(upload_to=get_notebook_dir) book = models.ForeignKey(Book) + screen_shots = models.ManyToManyField('ScreenShots') def __unicode__(self): name = self.name or 'Chapter' return '%s'%(name) diff --git a/tbc/templates/tbc/book-details.html b/tbc/templates/tbc/book-details.html index 415666d..dc8c272 100644 --- a/tbc/templates/tbc/book-details.html +++ b/tbc/templates/tbc/book-details.html @@ -19,7 +19,11 @@ function redirectToIpynb(notebook)
{% for image in images %}
- + {% if image.chapters_set.get.notebook %} + + {% else %} + + {% endif %}

{{ image.caption }}

{% endfor %} diff --git a/tbc/templates/tbc/book-review-details.html b/tbc/templates/tbc/book-review-details.html index 1aa888c..e546220 100644 --- a/tbc/templates/tbc/book-review-details.html +++ b/tbc/templates/tbc/book-review-details.html @@ -5,7 +5,11 @@
{% for image in images %}
- + {% if image.chapters_set.get.notebook %} + + {% else %} + + {% endif %}

{{ image.caption }}

{% endfor %} diff --git a/tbc/templates/tbc/update-code.html b/tbc/templates/tbc/update-code.html index cce2038..ee1d5b5 100644 --- a/tbc/templates/tbc/update-code.html +++ b/tbc/templates/tbc/update-code.html @@ -1,4 +1,15 @@ {% extends 'base.html' %} +{% block script %} + + +{% endblock %} {% block content %}

You are updating codes for the book {{ book.title }} by {{ book.author }}

@@ -6,17 +17,23 @@
{% csrf_token %} {% for chapter in chapters %} - - + + {% endfor %}

Upload 3 screenshots from any 3 random chapters and give proper captions

{% for screenshot in screenshots %} - - {% endfor %} -
+ + + {% endfor %} +

+
{% endblock %} diff --git a/tbc/templates/tbc/upload-content.html b/tbc/templates/tbc/upload-content.html index 2423bd4..0c187d9 100644 --- a/tbc/templates/tbc/upload-content.html +++ b/tbc/templates/tbc/upload-content.html @@ -1,7 +1,14 @@ {% extends 'base.html' %} {% block script %} +