diff options
author | hardythe1 | 2014-07-08 15:30:17 +0530 |
---|---|---|
committer | hardythe1 | 2014-07-08 15:30:17 +0530 |
commit | 2415d9e6616b2fbf3e2cf74a970b82e59868f18d (patch) | |
tree | ab22224925725d243d3f2ca52c85e0d0d0b88103 | |
parent | 0bfc7f75afc21c995c066ac8f4257d93c6a68473 (diff) | |
parent | ab992e3da65de1ad9ab18a6496007dc3a3fc6295 (diff) | |
download | Python-TBC-Interface-2415d9e6616b2fbf3e2cf74a970b82e59868f18d.tar.gz Python-TBC-Interface-2415d9e6616b2fbf3e2cf74a970b82e59868f18d.tar.bz2 Python-TBC-Interface-2415d9e6616b2fbf3e2cf74a970b82e59868f18d.zip |
Merge branch 'master' of https://github.com/FOSSEE/Python-TBC-Interface
-rw-r--r-- | tbc/models.py | 1 | ||||
-rw-r--r-- | tbc/templates/tbc/book-details.html | 2 | ||||
-rw-r--r-- | tbc/templates/tbc/upload-content.html | 2 | ||||
-rwxr-xr-x | tbc/views.py | 2 |
4 files changed, 5 insertions, 2 deletions
diff --git a/tbc/models.py b/tbc/models.py index 76c9dc6..56ea268 100644 --- a/tbc/models.py +++ b/tbc/models.py @@ -101,6 +101,7 @@ class ScreenShots(models.Model): caption = models.CharField(max_length=128) image = models.FileField(upload_to=get_image_dir) book = models.ForeignKey(Book) + chapter = models.ForeignKey(Chapters) def __unicode__(self): name = self.caption or 'ScreenShots' return '%s'%(name) diff --git a/tbc/templates/tbc/book-details.html b/tbc/templates/tbc/book-details.html index 3099063..6684244 100644 --- a/tbc/templates/tbc/book-details.html +++ b/tbc/templates/tbc/book-details.html @@ -19,7 +19,7 @@ function redirectToIpynb(notebook) <div class="row-fluid"> {% for image in images %} <div class ="module-list"> - <img src="{% static 'uploads/' %}{{ image.image }}"> + <a href="{% url 'tbc:ConvertNotebook' image.chapter.notebook %}"><img src="{% static 'uploads/' %}{{ image.image }}"></a> <center><p style="margin-top:30px;">{{ image.caption }}</p></center> </div> {% endfor %} diff --git a/tbc/templates/tbc/upload-content.html b/tbc/templates/tbc/upload-content.html index 62d2941..3b53ecc 100644 --- a/tbc/templates/tbc/upload-content.html +++ b/tbc/templates/tbc/upload-content.html @@ -55,7 +55,7 @@ function validate_content() {% endfor %} <br> <hr> - <p>Upload screenshots of Plots/Graphs/Charts(if any) "that you have plotted" and not from the textbook itself from any cahpter. If there are no plots/graphs/charts, then upload a screenshot of any chapter. Give proper captions for each of them. Only .png files are acceptable.</p> + <p>Upload screenshots of Plots/Graphs/Charts(if any) "that you have plotted" and not from the textbook itself from any cahpter. If there are no plots/graphs/charts, then upload a screenshot of any chapter. Also give the name of the chapter the screen shot is taken from. The name of the chapter you give should match the name of the chapter given above for its .ipynb file. Only .png files are acceptable.</p> {% for i in no_images %} <input type=text id=caption{{i}} name=caption{{i}} placeholder="Caption {{ forloop.counter }}"> <input type=file id=image{{i}} name=image{{i}}> diff --git a/tbc/views.py b/tbc/views.py index bc3913b..f45df40 100755 --- a/tbc/views.py +++ b/tbc/views.py @@ -348,6 +348,8 @@ def ContentUpload(request, book_id=None): screenshot = ScreenShots() screenshot.caption = request.POST['caption'+str(i)] screenshot.image = request.FILES['image'+str(i)] + chapter = Chapters.objects.get(name=request.POST['caption'+str(i)], book=curr_book) + screenshot.chapter = chapter screenshot.book = curr_book screenshot.save() book = Book.objects.order_by("-id")[0] |