summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.idea/FOSSEE_animations.iml4
-rw-r--r--.idea/dataSources.xml4
-rw-r--r--.idea/misc.xml4
-rw-r--r--fossee_anime/settings.py2
-rw-r--r--fossee_manim/forms.py250
-rw-r--r--fossee_manim/models.py19
-rw-r--r--fossee_manim/templates/fossee_manim/delete_proposal.html38
-rw-r--r--fossee_manim/templates/fossee_manim/edit_proposal.html222
-rw-r--r--fossee_manim/templates/fossee_manim/proposal_status.html2
-rw-r--r--fossee_manim/urls.py23
-rw-r--r--fossee_manim/views.py171
12 files changed, 496 insertions, 244 deletions
diff --git a/.gitignore b/.gitignore
index 7461676..5f6e127 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,7 @@ migrations/
#VS code
.vscode/
+.idea/
index_clutter.html
base_clutter.html
diff --git a/.idea/FOSSEE_animations.iml b/.idea/FOSSEE_animations.iml
index 201c35f..03a8da7 100644
--- a/.idea/FOSSEE_animations.iml
+++ b/.idea/FOSSEE_animations.iml
@@ -14,7 +14,11 @@
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
+<<<<<<< HEAD
<orderEntry type="jdk" jdkName="Python 2.7" jdkType="Python SDK" />
+=======
+ <orderEntry type="inheritedJdk" />
+>>>>>>> f79913639bc283c945a392d641e84b0a70a97eda
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
index 4ab70d8..ab6c21f 100644
--- a/.idea/dataSources.xml
+++ b/.idea/dataSources.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
+<<<<<<< HEAD
<data-source source="LOCAL" name="db" uuid="3317de75-8f14-4f8c-8836-39847d18f321">
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
@@ -19,6 +20,9 @@
</libraries>
</data-source>
<data-source source="LOCAL" name="Django default" uuid="ae398c8c-5a45-44f5-9195-355716353d9a">
+=======
+ <data-source source="LOCAL" name="Django default" uuid="c2ec2b16-9a8a-4975-be60-2a0417af82c8">
+>>>>>>> f79913639bc283c945a392d641e84b0a70a97eda
<driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize>
<imported>true</imported>
diff --git a/.idea/misc.xml b/.idea/misc.xml
index f99b311..a7e5d8b 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,9 @@
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
+<<<<<<< HEAD
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7" project-jdk-type="Python SDK" />
+=======
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" />
+>>>>>>> f79913639bc283c945a392d641e84b0a70a97eda
</project> \ No newline at end of file
diff --git a/fossee_anime/settings.py b/fossee_anime/settings.py
index 8b5f93a..82265ba 100644
--- a/fossee_anime/settings.py
+++ b/fossee_anime/settings.py
@@ -49,7 +49,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'taggit',
- 'simple_history'
+ 'simple_history',
]
MIDDLEWARE_CLASSES = [
diff --git a/fossee_manim/forms.py b/fossee_manim/forms.py
index 7cc1971..8bb3453 100644
--- a/fossee_manim/forms.py
+++ b/fossee_manim/forms.py
@@ -1,9 +1,9 @@
from django import forms
from django.utils import timezone
from .models import (
- Profile, User, Animation,
- Comment, AnimationStats
- )
+ Profile, User, Animation,
+ Comment, AnimationStats
+)
from string import punctuation, digits
try:
from string import letters
@@ -21,7 +21,7 @@ PWD_CHARS = letters + punctuation + digits
position_choices = (
("contributor", "Contributor"),
("reviewer", "Reviewer")
- )
+)
department_choices = (
("computer", "Dept. of Computer Science/Engg."),
@@ -36,7 +36,7 @@ department_choices = (
("electronics", "Dept. of Electronics"),
("energy science and engineering", "Dept. of Energy Science and Engg"),
("others", "Others")
- )
+)
title = (
("Professor", "Prof."),
@@ -47,7 +47,7 @@ title = (
("Mr", "Mr."),
("Mrs", "Mrs."),
("Miss", "Ms."),
- )
+)
source = (
("FOSSEE Email", "FOSSEE Email"),
@@ -56,46 +56,46 @@ source = (
("Social Media", "Social Media"),
("From other College", "From other College"),
("others", "Others")
- )
+)
states = (
- ("IN-AP", "Andhra Pradesh"),
- ("IN-AR", "Arunachal Pradesh"),
- ("IN-AS", "Assam"),
- ("IN-BR", "Bihar"),
- ("IN-CT", "Chhattisgarh"),
- ("IN-GA", "Goa"),
- ("IN-GJ", "Gujarat"),
- ("IN-HR", "Haryana"),
- ("IN-HP", "Himachal Pradesh"),
- ("IN-JK", "Jammu and Kashmir"),
- ("IN-JH", "Jharkhand"),
- ("IN-KA", "Karnataka"),
- ("IN-KL", "Kerala"),
- ("IN-MP", "Madhya Pradesh"),
- ("IN-MH", "Maharashtra"),
- ("IN-MN", "Manipur"),
- ("IN-ML", "Meghalaya"),
- ("IN-MZ", "Mizoram"),
- ("IN-NL", "Nagaland"),
- ("IN-OR", "Odisha"),
- ("IN-PB", "Punjab"),
- ("IN-RJ", "Rajasthan"),
- ("IN-SK", "Sikkim"),
- ("IN-TN", "Tamil Nadu"),
- ("IN-TG", "Telangana"),
- ("IN-TR", "Tripura"),
- ("IN-UT", "Uttarakhand"),
- ("IN-UP", "Uttar Pradesh"),
- ("IN-WB", "West Bengal"),
- ("IN-AN", "Andaman and Nicobar Islands"),
- ("IN-CH", "Chandigarh"),
- ("IN-DN", "Dadra and Nagar Haveli"),
- ("IN-DD", "Daman and Diu"),
- ("IN-DL", "Delhi"),
- ("IN-LD", "Lakshadweep"),
- ("IN-PY", "Puducherry")
- )
+ ("IN-AP", "Andhra Pradesh"),
+ ("IN-AR", "Arunachal Pradesh"),
+ ("IN-AS", "Assam"),
+ ("IN-BR", "Bihar"),
+ ("IN-CT", "Chhattisgarh"),
+ ("IN-GA", "Goa"),
+ ("IN-GJ", "Gujarat"),
+ ("IN-HR", "Haryana"),
+ ("IN-HP", "Himachal Pradesh"),
+ ("IN-JK", "Jammu and Kashmir"),
+ ("IN-JH", "Jharkhand"),
+ ("IN-KA", "Karnataka"),
+ ("IN-KL", "Kerala"),
+ ("IN-MP", "Madhya Pradesh"),
+ ("IN-MH", "Maharashtra"),
+ ("IN-MN", "Manipur"),
+ ("IN-ML", "Meghalaya"),
+ ("IN-MZ", "Mizoram"),
+ ("IN-NL", "Nagaland"),
+ ("IN-OR", "Odisha"),
+ ("IN-PB", "Punjab"),
+ ("IN-RJ", "Rajasthan"),
+ ("IN-SK", "Sikkim"),
+ ("IN-TN", "Tamil Nadu"),
+ ("IN-TG", "Telangana"),
+ ("IN-TR", "Tripura"),
+ ("IN-UT", "Uttarakhand"),
+ ("IN-UP", "Uttar Pradesh"),
+ ("IN-WB", "West Bengal"),
+ ("IN-AN", "Andaman and Nicobar Islands"),
+ ("IN-CH", "Chandigarh"),
+ ("IN-DN", "Dadra and Nagar Haveli"),
+ ("IN-DD", "Daman and Diu"),
+ ("IN-DL", "Delhi"),
+ ("IN-LD", "Lakshadweep"),
+ ("IN-PY", "Puducherry")
+)
def check_upper(uname):
@@ -111,7 +111,8 @@ class UserRegistrationForm(forms.Form):
a new user to the system"""
required_css_class = 'required'
errorlist_css_class = 'errorlist'
- username = forms.CharField(max_length=32, help_text='''lowercase, letters, digits,
+ username = forms.CharField(
+ max_length=32, help_text='''lowercase, letters, digits,
period and underscore only.''')
email = forms.EmailField()
password = forms.CharField(max_length=32, widget=forms.PasswordInput())
@@ -132,7 +133,9 @@ class UserRegistrationForm(forms.Form):
department = forms.ChoiceField(help_text='Department you work/study',
choices=department_choices)
location = forms.CharField(max_length=255, help_text="Place/City")
- pincode = forms.RegexField(regex=r'^.{6}$', error_messages={'invalid': "Please enter valid PINCODE"})
+ pincode = forms.RegexField(
+ regex=r'^.{6}$', error_messages={
+ 'invalid': "Please enter valid PINCODE"})
state = forms.ChoiceField(choices=states)
how_did_you_hear_about_us = forms.ChoiceField(choices=source)
@@ -213,11 +216,11 @@ class UserLoginForm(forms.Form):
super(UserLoginForm, self).clean()
try:
u_name, pwd = self.cleaned_data["username"],\
- self.cleaned_data["password"]
+ self.cleaned_data["password"]
user = authenticate(username=u_name, password=pwd)
except Exception:
- raise forms.ValidationError\
- ("Username and/or Password is not entered")
+ raise forms.ValidationError(
+ "Username and/or Password is not entered")
if not user:
raise forms.ValidationError("Invalid username/password")
return user
@@ -229,7 +232,7 @@ class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
fields = ['first_name', 'last_name', 'institute', 'department',
- ]
+ ]
first_name = forms.CharField(max_length=32)
last_name = forms.CharField(max_length=32)
@@ -253,13 +256,10 @@ class AnimationProposal(forms.ModelForm):
# self.fields['outline'].widget.attrs['placeholder'] = 'NOTE: Do\
# add info about prerequisites (if any), possible textbooks and \
# any other related information'
- self.fields['outline'].widget.attrs={
- 'id': 'custom_editor',
- 'rows': 10,
- 'cols': 50,
- 'placeholder': ('NOTE: Do add info about prerequisites (if any), possible textbooks and '
- 'any other related information')
- }
+ self.fields['outline'].widget.attrs = {
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'NOTE: Do add info about prerequisites (if any), possible textbooks and '
+ 'any other related information')}
class Meta:
model = Animation
@@ -277,58 +277,101 @@ class AnimationProposal_edit(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(AnimationProposal_edit, self).__init__(*args, **kwargs)
self.fields['subcategory'].widget.attrs['placeholder'] = 'Eg: Quantum Mechanics, Topology'
-
+ # self.fields['outline'].widget.attrs['placeholder'] = 'NOTE: Do\
+ # add info about prerequisites (if any), possible textbooks and \
+ # any other related information'
self.fields['outline'].widget.attrs = {
- 'id': 'custom_editor',
- 'rows': 10,
- 'cols': 50,
- 'placeholder': ('NOTE: Do add info about prerequisites (if any), possible textbooks and '
- 'any other related information')
- }
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'NOTE: Do add info about prerequisites (if any), possible textbooks and '
+ 'any other related information')}
self.fields['concepts'].widget.attrs = {
- 'id': 'custom_editor',
- 'rows': 10,
- 'cols': 50,
- 'placeholder': ('Which concept(s) do you want to animate?'
- 'Example: Animation of how data flows in Ring Topology')
- }
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'Which concept(s) do you want to animate?'
+ 'Example: Animation of how data flows in Ring Topology')}
self.fields['audience'].widget.attrs = {
- 'id': 'custom_editor',
- 'rows': 10,
- 'cols': 50,
- 'placeholder': ('Who would be the target audience for your video?\n'
- 'Example: High School Students, Mechanical Engineers, etc.')
- }
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'Who would be the target audience for your video?\n'
+ 'Example: High School Students, Mechanical Engineers, etc.')}
self.fields['reference'].widget.attrs = {
- 'id': 'custom_editor',
- 'rows': 10,
- 'cols': 50,
- 'placeholder': ('Please try to be as specific as possible. For example,\n'
- 'Book used: Linear Algebra.\n'
- 'Author: Kenneth Hoffman, Ray Kunze\n'
- 'Edition: Second\n'
- 'Chapter: 2 ; Page: 40')
- }
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'Please try to be as specific as possible. For example,\n'
+ 'Book used: Linear Algebra.\n'
+ 'Author: Kenneth Hoffman, Ray Kunze\n'
+ 'Edition: Second\n'
+ 'Chapter: 2 ; Page: 40')}
self.fields['tools'].widget.attrs = {
- 'id': 'custom_editor',
- 'rows': 10,
- 'cols': 50,
- 'placeholder': ('What all tools would you be using for animation?\n'
- 'Example: manim, blender, mayavi, mathbox, etc')
- }
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'What all tools would you be using for animation?\n'
+ 'Example: manim, blender, mayavi, mathbox, etc')}
self.fields['detaled_description'].widget.attrs = {
'id': 'custom_editor',
'rows': 10,
'cols': 50,
'placeholder': ('Give a detailed description of your animation')
}
- self.fields['link'].widget.attrs = {
+ self.fields['link'].widget.attrs = {'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'Along with the video you will have to submit the source code github link below.\n')}
+ self.fields['sketch'].label = "Sketch(.jpeg/.jpg only)"
+
+ class Meta:
+ model = Animation
+ widgets = {'sketch': forms.FileInput(), }
+ fields = [
+ 'category',
+ 'subcategory',
+ 'title',
+ 'outline',
+ 'tags',
+ 'concepts',
+ 'audience',
+ 'reference',
+ 'tools',
+ 'detaled_description',
+ 'link',
+ 'sketch']
+
+
+class AnimationProposal_edit(forms.ModelForm):
+ """Animation form """
+ required_css_class = 'required'
+ errorlist_css_class = 'errorlist'
+
+ def __init__(self, *args, **kwargs):
+ super(AnimationProposal_edit, self).__init__(*args, **kwargs)
+ self.fields['subcategory'].widget.attrs['placeholder'] = 'Eg: Quantum Mechanics, Topology'
+ self.fields['outline'].widget.attrs = {
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'NOTE: Do add info about prerequisites (if any), possible textbooks and '
+ 'any other related information')}
+ self.fields['concepts'].widget.attrs = {
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'Which concept(s) do you want to animate?'
+ 'Example: Animation of how data flows in Ring Topology')}
+ self.fields['audience'].widget.attrs = {
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'Who would be the target audience for your video?\n'
+ 'Example: High School Students, Mechanical Engineers, etc.')}
+
+ self.fields['reference'].widget.attrs = {
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'Please try to be as specific as possible. For example,\n'
+ 'Book used: Linear Algebra.\n'
+ 'Author: Kenneth Hoffman, Ray Kunze\n'
+ 'Edition: Second\n'
+ 'Chapter: 2 ; Page : 40')}
+ self.fields['tools'].widget.attrs = {
+ 'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'What all tools would you be using for animation?\n'
+ 'Example: manim, blender, mayavi, mathbox, etc')}
+ self.fields['detaled_description'].widget.attrs = {
'id': 'custom_editor',
'rows': 10,
'cols': 50,
- 'placeholder': ('Along with the video you will have to submit the source code github link below.\n')
+ 'placeholder': ('Give a detailed description of your animation')
}
+ self.fields['link'].widget.attrs = {'id': 'custom_editor', 'rows': 10, 'cols': 50, 'placeholder': (
+ 'Along with the video you will have to submit the source code github link below.\n')}
self.fields['sketch'].label = "Sketch(.jpeg/.jpg only)"
class Meta:
@@ -336,8 +379,19 @@ class AnimationProposal_edit(forms.ModelForm):
widgets = {
'sketch': forms.FileInput(),
}
- fields = ['category', 'subcategory', 'title', 'outline', 'tags', 'concepts', 'audience', 'reference', 'tools',
- 'detaled_description', 'link', 'sketch']
+ fields = [
+ 'category',
+ 'subcategory',
+ 'title',
+ 'outline',
+ 'tags',
+ 'concepts',
+ 'audience',
+ 'reference',
+ 'tools',
+ 'detaled_description',
+ 'link',
+ 'sketch']
class CommentForm(forms.ModelForm):
@@ -356,6 +410,7 @@ class CommentForm(forms.ModelForm):
'comments': forms.CharField(),
}
+
class UploadAnimationForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
@@ -365,6 +420,5 @@ class UploadAnimationForm(forms.ModelForm):
class Meta:
model = AnimationStats
exclude = ['animation', 'views', 'like', 'dislike', 'thumbnail']
- widgets = {
- 'video_path': forms.FileInput(),
- } \ No newline at end of file
+ widgets = {'video_path': forms.FileInput(),}
+
diff --git a/fossee_manim/models.py b/fossee_manim/models.py
index 3470115..25a7652 100644
--- a/fossee_manim/models.py
+++ b/fossee_manim/models.py
@@ -116,6 +116,13 @@ def validate_file_extension(value):
if not ext.lower() in valid_extensions:
raise ValidationError(u'Unsupported file extension.')
+def validate_img_extension(value):
+ import os
+ from django.core.exceptions import ValidationError
+ ext = os.path.splitext(value.name)[1] # [0] returns path+filename
+ valid_extensions = ['.jpg','.jpeg','.png']
+ if not ext.lower() in valid_extensions:
+ raise ValidationError(u'Unsupported file extension.')
class Profile(models.Model):
"""Profile for users(instructors and coordinators)"""
@@ -182,19 +189,27 @@ class Animation(models.Model):
on_delete=models.CASCADE,
related_name="%(app_label)s_%(class)s_related")
outline = models.TextField()
- # concepts = models.TextField()
- # audience=models.TextField()
status = models.CharField(max_length=255, choices=status)
category = models.ForeignKey(Category, on_delete=models.CASCADE)
subcategory = models.CharField(max_length=255, blank=True)
created = models.DateTimeField(default=timezone.now)
tags = TaggableManager()
history = HistoricalRecords()
+ # modifications
+ concepts=models.TextField(null=True,blank=True)
+ audience=models.TextField(null=True,blank=True)
+ reference=models.TextField(null=True,blank=True)
+ tools=models.TextField(null=True,blank=True)
+ detaled_description=models.TextField(null=True,blank=True)
+ link=models.CharField(max_length=255, blank=True)
+ sketch=models.ImageField(null=True, blank=True, upload_to=attachments, validators=[validate_img_extension])
def __str__(self):
return u"{0} | {1}".format(self.title, self.status)
+
+
class Comment(models.Model):
comment = models.TextField()
commentor = models.ForeignKey(User, on_delete=models.CASCADE)
diff --git a/fossee_manim/templates/fossee_manim/delete_proposal.html b/fossee_manim/templates/fossee_manim/delete_proposal.html
index 4c0db5e..9cae06e 100644
--- a/fossee_manim/templates/fossee_manim/delete_proposal.html
+++ b/fossee_manim/templates/fossee_manim/delete_proposal.html
@@ -1,24 +1,27 @@
{% extends 'fossee_manim/base.html' %}
{% block title %}
- Delete Proposal
+Delete Proposal
{% endblock %}
{% block content %}
- <br>
- <div class="container">
- <center>
- <h2>Delete Proposal : {{ proposal.title }}</h2>
- </center>
- <table class="table table-hover" style="font-family: 'Lato', sans-serif;">
- <tbody>
+<br>
+<div class="container">
+ <!--
+ This page shows the basic details of the proposal that the user choose to delete
+ -->
+ <center>
+ <h2>Delete Proposal : {{ proposal.title }}</h2>
+ </center>
+ <table class="table table-hover" style="font-family: 'Lato', sans-serif;">
+ <tbody>
<tr>
<td>Proposal Name :</td>
<td>{{ proposal.title }}</td>
</tr>
<tr>
<td>Proposal category :</td>
- <td>{{ proposal.categorye }}</td>
+ <td>{{ proposal.category }}</td>
</tr>
<tr>
<td>Sub Category :</td>
@@ -33,14 +36,15 @@
<td>{{ proposal.created }}</td>
</tr>
<tr>
-<td colspan="2">
- <center>
- <a href="{% url 'delete_proposal_info' proposal.id %}"><button type="button" class="btn btn-info" id="btnred">Delete {{ proposal.title }}</button></a>
- </center>
-</td>
+ <td colspan="2">
+ <center>
+ <a href="{% url 'delete_proposal' proposal.id %}"><button type="button"
+ class="btn btn-info" id="btnred">Delete {{ proposal.title }}</button></a>
+ </center>
+ </td>
</tr>
- </tbody>
- </table>
- </div>
+ </tbody>
+ </table>
+</div>
{% endblock %} \ No newline at end of file
diff --git a/fossee_manim/templates/fossee_manim/edit_proposal.html b/fossee_manim/templates/fossee_manim/edit_proposal.html
index 8543014..49bbfd0 100644
--- a/fossee_manim/templates/fossee_manim/edit_proposal.html
+++ b/fossee_manim/templates/fossee_manim/edit_proposal.html
@@ -1,131 +1,137 @@
{% extends 'fossee_manim/base.html' %}
{% block title %}
-Edit Proposal
+ Edit Proposal
{% endblock %}
{% block content %}
-<script type="text/javascript">
- var url = window.location.href.split('/').pop();
-</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 %}
+ <script type="text/javascript">
+ var url = window.location.href.split('/').pop();
+ </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 %}
+ <form method="POST">
+ {% csrf_token %}
- <table class="table table-bordered">
- {{ proposal_form.as_table }}
- </table>
+ <table class="table table-bordered">
+ <tr><td colspan="2"><center>PROPOSAL DETAILS</center></td></tr>
+ {{ proposal_form.as_table }}
+ </table>
- <br>
- <button class="btn btn-primary pull-right" type="submit" id="btnblue">Save</button>
- <br>
- </form>
- <br>
+ <br>
+ <button class="btn btn-primary pull-right" type="submit" id="btnblue">Save</button>
+ <br>
+ </form>
+ <br>
- {% if proposal_form.instance.status == 'changes' and request.user.profile.position == 'contributor' %}
- <form method="POST" action="{% url 'upload_animation' proposal_form.instance.id %}" enctype="multipart/form-data">
- {% csrf_token %}
- <label class="btn btn-info">
- {{ upload_form }}
- <button class="btn btn-success" type="submit">Upload</button>
- {{ msg }}
- </label>
- </form>
- {% 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>
+ {% if proposal_form.instance.status == 'changes' and request.user.profile.position == 'contributor' %}
+ <form method="POST" action="{% url 'upload_animation' proposal_form.instance.id %}"
+ enctype="multipart/form-data">
+ {% csrf_token %}
+ <label class="btn btn-info">
+ {{ upload_form }}
+ <button class="btn btn-success" type="submit">Upload</button>
+ {{ msg }}
+ </label>
+ </form>
+ {% 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>
- <source src="{{video.0.video_path.url}}" type="video/mp4">
- </video>
- {% endif %}
+ {% else %}
+ <video width="100%" height="100%" controls>
+ <source src="{{ video.0.video_path.url }}" type="video/mp4">
+ </video>
+ {% endif %}
- <br><br>
- {% if request.user.profile.position == 'reviewer' %}
- <form method="POST">
- {% csrf_token %}
- <div class="form-group">
- <div class="row">
- <button class="btn btn-success pull-left" type="submit" name="release" value="1">Approve</button>
- <button class="btn btn-danger pull-left" type="submit" name="rejected" value="2"
- style="margin-left: 1%">Reject</button>
- <button class="btn btn-info pull-left" type="submit" name="proposal_form" value="3" style="margin-left: 1%">Send
- Proposal 2 Form</button>
- </div>
- </div>
- </form>
- {% endif %}
- <br><br>
+ <br><br>
+ {% if request.user.profile.position == 'reviewer' %}
+ <form method="POST">
+ {% csrf_token %}
+ <div class="form-group">
+ <div class="row">
+ <button class="btn btn-success pull-left" type="submit" name="release" value="1">Approve
+ </button>
+ <button class="btn btn-danger pull-left" type="submit" name="rejected" value="2"
+ style="margin-left: 1%">Reject
+ </button>
+ {# <button class="btn btn-info pull-left" type="submit" name="proposal_form" value="3" style="margin-left: 1%">Send#}
+ {# Proposal 2 Form</button>#}
+ </div>
+ </div>
+ </form>
+ {% endif %}
+ <br><br>
- <h2>Comments</h2>
- <div>
- <form method="POST">
- <br>
- {% csrf_token %}
- {{ comment_form.as_p }}
- <button type="submit" class="btn btn-default">Post</button>
- </form>
+ <h2>Comments</h2>
+ <div>
+ <form method="POST">
+ <br>
+ {% csrf_token %}
+ {{ comment_form.as_p }}
+ <button type="submit" class="btn btn-default">Post</button>
+ </form>
- </div>
- <hr style="background-color: #fff;
+ </div>
+ <hr style="background-color: #fff;
border-top: 5px double #8c8b8b;">
- <table>
- {% for comment in comments %}
- <tbody>
- <tr>
- <td>
- <h5>{{ comment.commentor.profile.user.get_full_name }} | {{ comment.created_date | date }}</h5>
- <h6 style="background-color: #ecf0f1; padding:10px;">{{ comment.comment }}</h6>
- <hr style="border-top: 0.5px solid #8c8b8b;">
- </td>
- </tr>
- </tbody>
- {% endfor %}
- </table>
+ <table>
+ {% for comment in comments %}
+ <tbody>
+ <tr>
+ <td>
+ <h5>{{ comment.commentor.profile.user.get_full_name }} | {{ comment.created_date | date }}</h5>
+ <h6 style="background-color: #ecf0f1; padding:10px;">{{ comment.comment }}</h6>
+ <hr style="border-top: 0.5px solid #8c8b8b;">
+ </td>
+ </tr>
+ </tbody>
+ {% endfor %}
+ </table>
- <br><br>
-</div>
+ <br><br>
+ </div>
-<!-- Page Navigation -->
-<div class="container">
- <div class="Page-Nav" align="center">
- <nav aria-label="Page navigation">
- <ul class="pagination pagination-sm">
- <li class="page-item">
- {% if comments.has_previous %}
- <a class="page-link" tabindex="-1" href="?page={{ comments.previous_page_number }}">Previous</a>
- {% endif %}
- </li>
- <li class="page-item">
+ <!-- Page Navigation -->
+ <div class="container">
+ <div class="Page-Nav" align="center">
+ <nav aria-label="Page navigation">
+ <ul class="pagination pagination-sm">
+ <li class="page-item">
+ {% if comments.has_previous %}
+ <a class="page-link" tabindex="-1"
+ href="?page={{ comments.previous_page_number }}">Previous</a>
+ {% endif %}
+ </li>
+ <li class="page-item">
<span class="current">
Page {{ comments.number }} of {{ comments.paginator.num_pages }}
</span>
- </li>
- <li class="page-item">
- {% if comments.has_next %}
- <a class="page-link" href="?page={{ comments.next_page_number }}">Next
- </a>
- {% endif %}
- </li>
- </ul>
- </nav>
- </div>
- <br>
-</div>
+ </li>
+ <li class="page-item">
+ {% if comments.has_next %}
+ <a class="page-link" href="?page={{ comments.next_page_number }}">Next
+ </a>
+ {% endif %}
+ </li>
+ </ul>
+ </nav>
+ </div>
+ <br>
+ </div>
-</div>
+ </div>
{% endblock %} \ No newline at end of file
diff --git a/fossee_manim/templates/fossee_manim/proposal_status.html b/fossee_manim/templates/fossee_manim/proposal_status.html
index 81af9ec..fe2aa5e 100644
--- a/fossee_manim/templates/fossee_manim/proposal_status.html
+++ b/fossee_manim/templates/fossee_manim/proposal_status.html
@@ -94,7 +94,7 @@
{% endif %}
</td>
{% if request.user.profile.position == 'reviewer' %}
- <td><a href="{% url 'delete_proposal' an.id %}">
+ <td><a href="{% url 'show_proposal_detail' an.id %}">
<button type="button" class="btn btn-info" id="btnred">Delete</button>
</a></td>
{% endif %}
diff --git a/fossee_manim/urls.py b/fossee_manim/urls.py
index 3a9211a..f48a6c0 100644
--- a/fossee_manim/urls.py
+++ b/fossee_manim/urls.py
@@ -33,14 +33,21 @@ urlpatterns = [
url(r'^libraryPhys/$', views.libraryPhys, name='libraryPhys'),
url(r'^libraryCS/$', views.libraryCS, name='libraryCS'),
url(r'^explore/(?P<category>.+)$', views.explore,
- name='explore'),
- url(r'^show_proposal_detail/([1-9][0-9]*)$', views.show_proposal_detail, name='show_proposal_detail'),
- url(r'^delete_proposal/([1-9][0-9]*)$', views.delete_proposal, name='delete_proposal'),
- url(r'^sortproposal_released/$', views.sortproposal_released, name='sortproposal_released'),
- url(r'^sortproposal_rejected/$', views.sortproposal_rejected, name='sortproposal_rejected'),
- url(r'^sortproposal_changes/', views.sortproposal_changes, name='sortproposal_changes'),
- url(r'^sortproposal_pending/$', views.sortproposal_pending, name='sortproposal_pending'),
- url(r'^search_proposal/$', views.search_proposal, name='search_proposal'),
+ name='explore'),
+ url(r'^show_proposal_detail/([1-9][0-9]*)$', views.show_proposal_detail,
+ name='show_proposal_detail'),
+ url(r'^delete_proposal/([1-9][0-9]*)$', views.delete_proposal,
+ name='delete_proposal'),
+ url(r'^sortproposal_released/$', views.sortproposal_released,
+ name='sortproposal_released'),
+ url(r'^sortproposal_rejected/$', views.sortproposal_rejected,
+ name='sortproposal_rejected'),
+ url(r'^sortproposal_changes/', views.sortproposal_changes,
+ name='sortproposal_changes'),
+ url(r'^sortproposal_pending/$', views.sortproposal_pending,
+ name='sortproposal_pending'),
+ url(r'^search_proposal/$', views.search_proposal,
+ name='search_proposal'),
]
urlpatterns += static(
diff --git a/fossee_manim/views.py b/fossee_manim/views.py
index b8ab7b0..fa89cb2 100644
--- a/fossee_manim/views.py
+++ b/fossee_manim/views.py
@@ -346,6 +346,154 @@ def proposal_status(request):
return redirect('/login/')
+# this method return the proposal in the status of released
+@login_required
+def sortproposal_released(request):
+ user = request.user
+ if is_email_checked(user) and user.is_authenticated():
+ profile = Profile.objects.get(user_id=user)
+ categories = Category.objects.all()
+ if profile.position == 'contributor':
+ # filtering with the proposal status
+ animations = Animation.objects.filter(
+ contributor_id=user, status='released').order_by('-created')
+ else:
+ # filtering with the proposal status
+ animations = Animation.objects.filter(
+ status='released').order_by('-created')
+ # print(animations)
+
+ # Show upto 9 proposals per page
+ paginator = Paginator(list(animations), 9)
+ page = request.GET.get('page')
+ try:
+ anime = paginator.page(page)
+ print(animations.count(), anime)
+ except PageNotAnInteger:
+ # If page is not an integer, deliver first page.
+ anime = paginator.page(1)
+ except EmptyPage:
+ # If page is out of range(e.g 999999), deliver last page.
+ anime = paginator.page(paginator.num_pages)
+
+ return render(request, 'fossee_manim/proposal_status.html',
+ {'anime': anime,
+ 'categories': categories})
+ else:
+ return redirect('/login/')
+
+
+# this method return the proposal in the status of rejected
+@login_required
+def sortproposal_rejected(request):
+ user = request.user
+ if is_email_checked(user) and user.is_authenticated():
+ profile = Profile.objects.get(user_id=user)
+ categories = Category.objects.all()
+ if profile.position == 'contributor':
+ # filtering with the proposal status
+ animations = Animation.objects.filter(
+ contributor_id=user, status='rejected').order_by('-created')
+ else:
+ # filtering with the proposal status
+ animations = Animation.objects.filter(
+ status='rejected').order_by('-created')
+ # print(animations)
+
+ # Show upto 9 proposals per page
+ paginator = Paginator(list(animations), 9)
+ page = request.GET.get('page')
+ try:
+ anime = paginator.page(page)
+ print(animations.count(), anime)
+ except PageNotAnInteger:
+ # If page is not an integer, deliver first page.
+ anime = paginator.page(1)
+ except EmptyPage:
+ # If page is out of range(e.g 999999), deliver last page.
+ anime = paginator.page(paginator.num_pages)
+
+ return render(request, 'fossee_manim/proposal_status.html',
+ {'anime': anime,
+ 'categories': categories})
+ else:
+ return redirect('/login/')
+
+
+# this method return the proposal in the status of changes
+@login_required
+def sortproposal_changes(request):
+ user = request.user
+ if is_email_checked(user) and user.is_authenticated():
+ profile = Profile.objects.get(user_id=user)
+ categories = Category.objects.all()
+ if profile.position == 'contributor':
+ # filtering with the proposal status
+ animations = Animation.objects.filter(
+ contributor_id=user, status='changes').order_by('-created')
+ else:
+ # filtering with the proposal status
+ animations = Animation.objects.filter(
+ status='changes').order_by('-created')
+ # print(animations)
+
+ # Show upto 9 proposals per page
+ paginator = Paginator(list(animations), 9)
+ page = request.GET.get('page')
+ try:
+ anime = paginator.page(page)
+ print(animations.count(), anime)
+ except PageNotAnInteger:
+ # If page is not an integer, deliver first page.
+ anime = paginator.page(1)
+ except EmptyPage:
+ # If page is out of range(e.g 999999), deliver last page.
+ anime = paginator.page(paginator.num_pages)
+
+ return render(request, 'fossee_manim/proposal_status.html',
+ {'anime': anime,
+ 'categories': categories})
+ else:
+ return redirect('/login/')
+
+
+# this method return the proposal in the status of pending
+@login_required
+def sortproposal_pending(request):
+ user = request.user
+ if is_email_checked(user) and user.is_authenticated():
+ profile = Profile.objects.get(user_id=user)
+ categories = Category.objects.all()
+ if profile.position == 'contributor':
+ # filtering with the proposal status
+ animations = Animation.objects.filter(
+ contributor_id=user, status='pending').order_by('-created')
+ else:
+ # filtering with the proposal status
+ animations = Animation.objects.filter(
+ status='pending').order_by('-created')
+ # print(animations)
+
+ # Show upto 9 proposals per page
+ paginator = Paginator(list(animations), 9)
+ page = request.GET.get('page')
+ try:
+ anime = paginator.page(page)
+ print(animations.count(), anime)
+ except PageNotAnInteger:
+ # If page is not an integer, deliver first page.
+ anime = paginator.page(1)
+ except EmptyPage:
+ # If page is out of range(e.g 999999), deliver last page.
+ anime = paginator.page(paginator.num_pages)
+
+ return render(request, 'fossee_manim/proposal_status.html',
+ {'anime': anime,
+ 'categories': categories})
+ else:
+ return redirect('/login/')
+
+
@login_required
def sortproposal_released(request):
user = request.user
@@ -577,14 +725,17 @@ def edit_proposal(request, proposal_id=None):
'msg': msg})
+# this method is used to return the details the proposal selected to delete
@login_required
def show_proposal_detail(request, proposal_id=None):
user = request.user
if is_email_checked(user) and user.is_authenticated():
try:
proposal = Animation.objects.get(id=proposal_id)
- return render(request, 'fossee_manim/delete_proposal.html', {'proposal': proposal})
- except:
+ return render(request,
+ 'fossee_manim/delete_proposal.html',
+ {'proposal': proposal})
+ except BaseException:
profile = Profile.objects.get(user_id=user)
categories = Category.objects.all()
if profile.position == 'contributor':
@@ -592,7 +743,7 @@ def show_proposal_detail(request, proposal_id=None):
contributor_id=user).order_by('-created')
else:
animations = Animation.objects.order_by('-created')
-
+
paginator = Paginator(list(animations), 9)
page = request.GET.get('page')
try:
@@ -604,12 +755,13 @@ def show_proposal_detail(request, proposal_id=None):
anime = paginator.page(paginator.num_pages)
return render(request, 'fossee_manim/proposal_status.html',
- {'anime': anime,
- 'categories': categories})
+ {'anime': anime,
+ 'categories': categories})
else:
return redirect('/register/')
+# this method is used to delete the selected proposal by the reviever
@login_required
def delete_proposal(request, proposal_id=None):
user = request.user
@@ -634,8 +786,9 @@ def delete_proposal(request, proposal_id=None):
except EmptyPage:
anime = paginator.page(paginator.num_pages)
- return render(request, 'fossee_manim/proposal_status.html', {'anime': anime, 'categories': categories})
- except:
+ return render(request, 'fossee_manim/proposal_status.html',
+ {'anime': anime, 'categories': categories})
+ except BaseException:
profile = Profile.objects.get(user_id=user)
categories = Category.objects.all()
if profile.position == 'contributor':
@@ -655,8 +808,8 @@ def delete_proposal(request, proposal_id=None):
anime = paginator.page(paginator.num_pages)
return render(request, 'fossee_manim/proposal_status.html',
- {'anime': anime,
- 'categories': categories})
+ {'anime': anime,
+ 'categories': categories})
else:
return redirect('/login/')