diff options
author | hardythe1 | 2015-03-13 15:21:58 +0530 |
---|---|---|
committer | hardythe1 | 2015-03-13 15:21:58 +0530 |
commit | 707af515ef317adc74d6ad9f0c912eb598c5ff9f (patch) | |
tree | 17efe3e1d707d7eaf1c8021ffbb934c0cc54aef9 /tbc | |
parent | 4f11d251ce6922f3e6091b4d588b2a640d58ef5d (diff) | |
download | Python-TBC-Interface-707af515ef317adc74d6ad9f0c912eb598c5ff9f.tar.gz Python-TBC-Interface-707af515ef317adc74d6ad9f0c912eb598c5ff9f.tar.bz2 Python-TBC-Interface-707af515ef317adc74d6ad9f0c912eb598c5ff9f.zip |
updated new path to clean the URLs
Diffstat (limited to 'tbc')
-rwxr-xr-x | tbc/templates/base.html | 2 | ||||
-rwxr-xr-x | tbc/views.py | 41 |
2 files changed, 19 insertions, 24 deletions
diff --git a/tbc/templates/base.html b/tbc/templates/base.html index d4c3a9e..5d0c844 100755 --- a/tbc/templates/base.html +++ b/tbc/templates/base.html @@ -295,7 +295,7 @@ <div style="clear:both;"></div> {% for item in items %} <div class ="module-list"> - <a href="{% url 'tbc:BookDetails' item.book.id %}"><img src="{% static 'uploads/' %}{{ item.image.image }}"></a> + <a href="{% url 'tbc:BookDetails' item.book.id %}"><img src="{% static 'Python-Textbook-Companions/' %}{{ item.image.image }}"></a> <center><a href="{% url 'tbc:BookDetails' item.book.id %}">{{ item.book.title }}</a></center> </div> {% endfor %} diff --git a/tbc/views.py b/tbc/views.py index 2d246ed..5b2802c 100755 --- a/tbc/views.py +++ b/tbc/views.py @@ -1029,29 +1029,11 @@ def ApproveBook(request, book_id=None): if is_reviewer(request.user): if request.method == 'POST' and request.POST['approve_notify'] == "approve": book = Book.objects.get(id=book_id) - book.approved = True - book.save() - try: - proposal = Proposal.objects.get(accepted=book) - proposal.status = "book completed" - proposal.save() - msg = "Book Approved" - except Proposal.DoesNotExist: - proposal = Proposal() - proposal.user = book.contributor - proposal.accepted = book - proposal.status = "book completed" - proposal.save() - msg = "Old Book Approved" - file_path = os.path.abspath(os.path.dirname(__file__)) - copy_path = "/".join(file_path.split("/")[1:-2]) - copy_path = "/"+copy_path+"/Python-Textbook-Companions/" - file_path = file_path+"/static/uploads/" - directory = file_path+book.contributor.user.first_name - os.chmod(directory, 0777) - os.chdir(directory) + file_path = local.path book_title = book.title.replace(" ", "_") - fp = open(book_title+"/README.txt", 'w') + directory = file_path+book_title + os.chdir(directory) + fp = open(directory+"/README.txt", 'w') fp.write("Contributed By: "+book.contributor.user.first_name+" "+book.contributor.user.last_name+"\n") fp.write("Course: "+book.contributor.course+"\n") fp.write("College/Institute/Organization: "+book.contributor.insti_org+"\n") @@ -1063,7 +1045,20 @@ def ApproveBook(request, book_id=None): fp.write("Isbn: "+book.isbn+"\n") fp.write("Edition: "+book.edition) fp.close() - os.popen("cp -r '"+book_title+"' '"+copy_path+"'") + try: + proposal = Proposal.objects.get(accepted=book) + proposal.status = "book completed" + proposal.save() + msg = "Book Approved" + except Proposal.DoesNotExist: + proposal = Proposal() + proposal.user = book.contributor + proposal.accepted = book + proposal.status = "book completed" + proposal.save() + msg = "Old Book Approved" + book.approved = True + book.save() subject = "Python-TBC: Book Completion" message = """Hi """+book.contributor.user.first_name+""",\n Congratulations !\nThe book - """+book.title+""" is now complete & published.\nPlease visit the link given below to download the forms to be filled to complete the formalities.\nhttp://tbc-python.fossee.in/internship-forms\nThe forms should be duly filled (fill only the sections which are applicable) & submitted at the following address:\nDr. Prabhu Ramachandran,\nDepartment of Aerospace Engineering,\nIIT Bombay, Powai, Mumbai - 400076\nKindly write Python Textbook Companion on top of the envelope.\nIf you already sent the forms then you may kindly ignore this mail.\n\nThank You for your contribution !\nRegards,\n Python TBC Team,\nFOSSEE - IIT Bombay""" |