summaryrefslogtreecommitdiff
path: root/fossee_manim
diff options
context:
space:
mode:
authorAkshen2019-05-14 17:22:34 +0530
committerAkshen2019-05-14 17:22:34 +0530
commit56f6cd0ef216cdc47e9651398f6aac438d9e9054 (patch)
treeea732c29828daa1ca6b7f0fed1bc08dad25d4eb5 /fossee_manim
parentf5f525368c6054c31abf6c0ff786a31b2a388661 (diff)
downloadFOSSEE_animations-56f6cd0ef216cdc47e9651398f6aac438d9e9054.tar.gz
FOSSEE_animations-56f6cd0ef216cdc47e9651398f6aac438d9e9054.tar.bz2
FOSSEE_animations-56f6cd0ef216cdc47e9651398f6aac438d9e9054.zip
Handle blank file upload button on edit proposal
Diffstat (limited to 'fossee_manim')
-rw-r--r--fossee_manim/templates/fossee_manim/base.html2
-rw-r--r--fossee_manim/templates/fossee_manim/edit_proposal.html16
-rw-r--r--fossee_manim/views.py42
3 files changed, 38 insertions, 22 deletions
diff --git a/fossee_manim/templates/fossee_manim/base.html b/fossee_manim/templates/fossee_manim/base.html
index 1a4945d..495831d 100644
--- a/fossee_manim/templates/fossee_manim/base.html
+++ b/fossee_manim/templates/fossee_manim/base.html
@@ -68,7 +68,7 @@
</div>
{% else %}
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
- <a class="dropdown-item" href="{% url 'proposal_status' %}">Proposal Status</a>
+ <a class="dropdown-item" href="{% url 'proposal_status' %}">Submitted Proposals</a>
<a class="dropdown-item" href="{% url 'view_profile' %}">View Profile</a>
<a class="dropdown-item" href="{% url 'logout' %}">Logout</a>
</div>
diff --git a/fossee_manim/templates/fossee_manim/edit_proposal.html b/fossee_manim/templates/fossee_manim/edit_proposal.html
index 08fe638..4cae2e7 100644
--- a/fossee_manim/templates/fossee_manim/edit_proposal.html
+++ b/fossee_manim/templates/fossee_manim/edit_proposal.html
@@ -10,6 +10,17 @@
</script>
<br>
<div class="container">
+ {% if messages %}
+ <ul class="messages">
+ {% for message in messages %}
+ <div class="alert alert-{{ message.tags }}">
+ <li {% if message.tags %} class="{{ message.tags }}"{% endif %}> {{ message }}
+ </li>
+ </div>
+ {% endfor %}
+ </ul>
+ {% endif %}
+
<form method="POST" >
{% csrf_token %}
@@ -31,8 +42,9 @@
<button class="btn btn-success" type="submit">Upload</button>
</label>
</form>
- {% elif proposal_form.instance.status == 'pending' %}
- <h3>Awaiting Reviewer's Moderation </h3>
+ {% elif proposal_form.instance.status == 'pending' and request.user.profile.position == 'contributor' %}
+ <h3>Awaiting Reviewer's Moderation </h3>
+ <h6>Further details regarding the second stage of Proposal will be shared with you over the email shortly</h6>
{% else %}
<video width="100%" height="100%" controls>
diff --git a/fossee_manim/views.py b/fossee_manim/views.py
index fde164b..e72aa2d 100644
--- a/fossee_manim/views.py
+++ b/fossee_manim/views.py
@@ -423,26 +423,30 @@ def upload_animation(request, proposal_id=None):
anim_stats = UploadAnimationForm(request.POST or None,
request.FILES or None)
if anim_stats.is_valid():
- anim = AnimationStats.objects.filter(
- animation=proposal)
- if anim.exists():
- anobj = anim.first()
- try:
- remove(anobj.thumbnail.path)
- except:
- pass
- remove(anobj.video_path.path)
- anobj.delete()
- anobj = AnimationStats.objects.create(
- animation=proposal, video_path=request.FILES['video_path'])
- else:
- anobj = AnimationStats.objects.create(
- animation=proposal, video_path=request.FILES['video_path'])
- anobj._create_thumbnail()
+ try:
+ anim = AnimationStats.objects.filter(
+ animation=proposal)
+ if anim.exists():
+ anobj = anim.first()
+ try:
+ remove(anobj.thumbnail.path)
+ except:
+ pass
+ remove(anobj.video_path.path)
+ anobj.delete()
+ anobj = AnimationStats.objects.create(
+ animation=proposal, video_path=request.FILES['video_path'])
+ else:
+ anobj = AnimationStats.objects.create(
+ animation=proposal, video_path=request.FILES['video_path'])
+ anobj._create_thumbnail()
+ return render(request, 'fossee_manim/upload_success.html')
+ except:
+ messages.warning(request, 'Please Upload a valid File')
+ return redirect('/edit_proposal/{}'.format(proposal_id))
- return render(request, 'fossee_manim/upload_success.html')
- else:
- return redirect('/view_profile/')
+ else:
+ return redirect('/view_profile/')
else:
return redirect('/login/')