summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fossee_manim/forms.py189
-rw-r--r--fossee_manim/urls.py28
-rw-r--r--fossee_manim/views.py153
3 files changed, 204 insertions, 166 deletions
diff --git a/fossee_manim/forms.py b/fossee_manim/forms.py
index 8b7eada..0836e47 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
@@ -281,56 +281,37 @@ class AnimationProposal_edit(forms.ModelForm):
# 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 = {
- '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['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:
@@ -338,8 +319,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):
@@ -358,6 +350,7 @@ class CommentForm(forms.ModelForm):
'comments': forms.CharField(),
}
+
class UploadAnimationForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
diff --git a/fossee_manim/urls.py b/fossee_manim/urls.py
index 9615d47..372ebe7 100644
--- a/fossee_manim/urls.py
+++ b/fossee_manim/urls.py
@@ -26,24 +26,24 @@ urlpatterns = [
url(r'^faqs/$', views.faqs, name='faqs'),
url(r'^search_category/(?P<cat>.+)$', views.search_category,
name='search_category'),
- url(r'^about/$',views.about, name='about'),
- url(r'^outreach/$',views.outreach, name='outreach'),
- url(r'^library/$',views.library, name='library'),
- url(r'^libraryMath/$',views.libraryMath, name='libraryMath'),
- url(r'^libraryPhys/$',views.libraryPhys, name='libraryPhys'),
- url(r'^libraryCS/$',views.libraryCS, name='libraryCS'),
+ url(r'^about/$', views.about, name='about'),
+ url(r'^outreach/$', views.outreach, name='outreach'),
+ url(r'^library/$', views.library, name='library'),
+ url(r'^libraryMath/$', views.libraryMath, name='libraryMath'),
+ 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'^delete_proposal/([1-9][0-9]*)$',views.delete_proposal,name='delete_proposal'),
- url(r'^delete_proposal_info/([1-9][0-9]*)$',views.delete_proposal_info,name='delete_proposal_info'),
- 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'^delete_proposal/([1-9][0-9]*)$', views.delete_proposal, name='delete_proposal'),
+ url(r'^delete_proposal_info/([1-9][0-9]*)$', views.delete_proposal_info, name='delete_proposal_info'),
+ 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(
- settings.MEDIA_URL,
- document_root=settings.MEDIA_ROOT
+ settings.MEDIA_URL,
+ document_root=settings.MEDIA_ROOT
)
diff --git a/fossee_manim/views.py b/fossee_manim/views.py
index 314b83f..e7a3aee 100644
--- a/fossee_manim/views.py
+++ b/fossee_manim/views.py
@@ -35,9 +35,14 @@ except ImportError:
from io import BytesIO as string_io
__author__ = "Akshen Doke"
-__credits__ = ["Prabhu Ramachandran", "Aditya P.", "KhushalSingh Rajput",
- "Prathamesh Salunke", "Purusharth Saxsena", "Sharanya Achut", "Ankit Javalkar"
- ]
+__credits__ = [
+ "Prabhu Ramachandran",
+ "Aditya P.",
+ "KhushalSingh Rajput",
+ "Prathamesh Salunke",
+ "Purusharth Saxsena",
+ "Sharanya Achut",
+ "Ankit Javalkar"]
def makepath(proposal_data, reject=None):
@@ -52,10 +57,9 @@ def makepath(proposal_data, reject=None):
settings.MEDIA_ROOT, proposal_data.category.name,
proposal_data.title.replace(" ", "_")
))
- except:
+ except BaseException:
logging.info("Proposal rejected")
-
else:
makedirs(path.join(settings.MEDIA_ROOT, proposal_data.category.name,
proposal_data.title.replace(" ", "_")
@@ -65,7 +69,7 @@ def makepath(proposal_data, reject=None):
def check_repo(link):
try:
return (get(link).status_code == 200)
- except:
+ except BaseException:
return False
@@ -88,7 +92,9 @@ def index(request):
categories = Category.objects.all()
if user.is_authenticated() and is_email_checked(user):
return redirect('/proposal_status/')
- return render(request, "fossee_manim/index.html", {"categories": categories})
+ return render(request,
+ "fossee_manim/index.html",
+ {"categories": categories})
def is_reviewer(user):
@@ -119,8 +125,8 @@ def user_login(request):
return render(request, 'fossee_manim/login.html', {"form": form})
else:
form = UserLoginForm()
- return render(request, 'fossee_manim/login.html', {"form": form,
- 'categories': categories})
+ return render(request, 'fossee_manim/login.html',
+ {"form": form, 'categories': categories})
def user_logout(request):
@@ -154,7 +160,7 @@ def activate_user(request, key=None):
try:
user = Profile.objects.get(activation_key=key)
- except:
+ except BaseException:
return redirect('/register/')
if key == user.activation_key:
@@ -198,14 +204,18 @@ def user_register(request):
elif request.user.is_authenticated():
return render(request, 'fossee_manim/activation.html')
form = UserRegistrationForm()
- return render(request, "fossee_manim/register.html", {'form': form, 'categories': categories})
+ return render(request, "fossee_manim/register.html",
+ {'form': form, 'categories': categories})
def explore(request, category):
categories = Category.objects.all() # not related to category below
- videos = AnimationStats.objects.filter(animation__category__name=category, animation__status="released")
+ videos = AnimationStats.objects.filter(
+ animation__category__name=category,
+ animation__status="released")
- return render(request, "fossee_manim/explore.html", {"videos": videos, "categories": categories})
+ return render(request, "fossee_manim/explore.html",
+ {"videos": videos, "categories": categories})
@login_required
@@ -225,7 +235,7 @@ def view_profile(request):
try:
logout(request)
return redirect('/login/')
- except:
+ except BaseException:
return redirect('/register/')
@@ -246,7 +256,7 @@ def edit_profile(request):
try:
logout(request)
return redirect('/login/')
- except:
+ except BaseException:
return redirect('/register/')
context = {'template': template}
@@ -274,9 +284,8 @@ def edit_profile(request):
return render(request, 'fossee_manim/edit_profile.html', context)
else:
form = ProfileForm(user=user, instance=profile)
- return render(request, 'fossee_manim/edit_profile.html', {'form': form,
- 'categories': categories}
- )
+ return render(request, 'fossee_manim/edit_profile.html',
+ {'form': form, 'categories': categories})
@login_required
@@ -310,7 +319,8 @@ def proposal_status(request):
profile = Profile.objects.get(user_id=user)
categories = Category.objects.all()
if profile.position == 'contributor':
- animations = Animation.objects.filter(contributor_id=user).order_by('-created')
+ animations = Animation.objects.filter(
+ contributor_id=user).order_by('-created')
else:
animations = Animation.objects.order_by('-created')
# print(animations)
@@ -344,11 +354,12 @@ def sortproposal_released(request):
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')
+ 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')
+ animations = Animation.objects.filter(
+ status='released').order_by('-created')
# print(animations)
# Show upto 9 proposals per page
@@ -380,11 +391,12 @@ def sortproposal_rejected(request):
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')
+ 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')
+ animations = Animation.objects.filter(
+ status='rejected').order_by('-created')
# print(animations)
# Show upto 9 proposals per page
@@ -416,11 +428,12 @@ def sortproposal_changes(request):
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')
+ 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')
+ animations = Animation.objects.filter(
+ status='changes').order_by('-created')
# print(animations)
# Show upto 9 proposals per page
@@ -452,11 +465,12 @@ def sortproposal_pending(request):
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')
+ 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')
+ animations = Animation.objects.filter(
+ status='pending').order_by('-created')
# print(animations)
# Show upto 9 proposals per page
@@ -478,6 +492,7 @@ def sortproposal_pending(request):
else:
return redirect('/login/')
+
@login_required
def edit_proposal(request, proposal_id=None):
user = request.user
@@ -489,14 +504,15 @@ def edit_proposal(request, proposal_id=None):
categories = Category.objects.all()
video = AnimationStats.objects.filter(animation=proposal_id)
if len(video) > 0:
- msg = ('Previously a video was uploaded for ' + video[0].animation.title)
+ msg = (
+ 'Previously a video was uploaded for ' +
+ video[0].animation.title)
else:
msg = ('No video uploaded')
try:
- comments = Comment.objects.filter(animation_id=proposal_id).order_by(
- '-created_date'
- )
- except:
+ comments = Comment.objects.filter(
+ animation_id=proposal_id).order_by('-created_date')
+ except BaseException:
comments = None
if request.method == 'POST':
text = request.POST.get('comment')
@@ -536,7 +552,8 @@ def edit_proposal(request, proposal_id=None):
proposal=proposal)
form_data.save()
return redirect('/edit_proposal/{}'.format(proposal_id))
- proposal_form = AnimationProposal_edit(request.POST, instance=proposal)
+ proposal_form = AnimationProposal_edit(
+ request.POST, instance=proposal)
if proposal_form.is_valid():
p_f = proposal_form.save(commit=False)
p_f.contributor = user
@@ -578,7 +595,9 @@ def delete_proposal(request, proposal_id=None):
if is_email_checked(user) and user.is_authenticated():
proposal = Animation.objects.get(id=proposal_id)
- return render(request, 'fossee_manim/delete_proposal.html', {'proposal': proposal})
+ return render(request,
+ 'fossee_manim/delete_proposal.html',
+ {'proposal': proposal})
else:
return redirect('/register/')
@@ -595,7 +614,8 @@ def delete_proposal_info(request, proposal_id=None):
profile = Profile.objects.get(user_id=user)
categories = Category.objects.all()
if profile.position == 'contributor':
- animations = Animation.objects.filter(contributor_id=user).order_by('-created')
+ animations = Animation.objects.filter(
+ contributor_id=user).order_by('-created')
else:
animations = Animation.objects.order_by('-created')
paginator = Paginator(list(animations), 9)
@@ -608,7 +628,8 @@ def delete_proposal_info(request, proposal_id=None):
except EmptyPage:
anime = paginator.page(paginator.num_pages)
- return render(request, 'fossee_manim/proposal_status.html',{'anime': anime,'categories': categories})
+ return render(request, 'fossee_manim/proposal_status.html',
+ {'anime': anime, 'categories': categories})
else:
return redirect('/login/')
@@ -618,14 +639,19 @@ def search(request):
if request.method == 'POST':
word = request.POST.get('sbox')
anime_list = AnimationStats.objects.filter(
- Q(animation__title__contains=word) | Q(animation__outline__contains=word)
- | Q(animation__category__name__contains=word) | Q(animation__subcategory__contains=word),
+ Q(
+ animation__title__contains=word) | Q(
+ animation__outline__contains=word) | Q(
+ animation__category__name__contains=word) | Q(
+ animation__subcategory__contains=word),
animation__status='released')
return render(request, 'fossee_manim/search_results.html',
{'s_result': anime_list, 'categories': categories})
# search results for proposal
+
+
def search_proposal(request):
user = request.user
if is_email_checked(user) and user.is_authenticated():
@@ -651,6 +677,7 @@ def search_proposal(request):
else:
return redirect('/login/')
+
@login_required
def upload_animation(request, proposal_id=None):
user = request.user
@@ -667,7 +694,7 @@ def upload_animation(request, proposal_id=None):
anobj = anim.first()
try:
remove(anobj.thumbnail.path)
- except:
+ except BaseException:
pass
remove(anobj.video_path.path)
anobj.delete()
@@ -678,7 +705,7 @@ def upload_animation(request, proposal_id=None):
animation=proposal, video_path=request.FILES['video_path'])
anobj._create_thumbnail()
return render(request, 'fossee_manim/upload_success.html')
- except:
+ except BaseException:
messages.warning(request, 'Please Upload a valid File')
return redirect('/edit_proposal/{}'.format(proposal_id))
@@ -698,7 +725,7 @@ def video(request, aid=None):
video.update(like=F('like') + 1)
anim_list = AnimationStats.objects.filter(animation__status="released")
suggestion_list = [x for x in anim_list if (
- x.animation.category == video[0].animation.category)]
+ x.animation.category == video[0].animation.category)]
reviewer_id = video[0].animation.reviewer.id
comment_list = Comment.objects.filter(animation=video[0].animation)
comments = [x for x in comment_list if x.animation_status not in
@@ -741,44 +768,62 @@ def search_category(request, cat=None):
def guidelines(request):
categories = Category.objects.all()
- return render(request, 'fossee_manim/guidelines.html', {'categories': categories})
+ return render(request,
+ 'fossee_manim/guidelines.html',
+ {'categories': categories})
def about(request):
categories = Category.objects.all()
- return render(request, 'fossee_manim/about.html', {'categories': categories})
+ return render(request,
+ 'fossee_manim/about.html',
+ {'categories': categories})
def honorarium(request):
categories = Category.objects.all()
- return render(request, 'fossee_manim/honorarium.html', {'categories': categories})
+ return render(request,
+ 'fossee_manim/honorarium.html',
+ {'categories': categories})
def faqs(request):
categories = Category.objects.all()
- return render(request, 'fossee_manim/faqs.html', {'categories': categories})
+ return render(request,
+ 'fossee_manim/faqs.html',
+ {'categories': categories})
def outreach(request):
categories = Category.objects.all()
- return render(request, 'fossee_manim/outreach.html', {'categories': categories})
+ return render(request,
+ 'fossee_manim/outreach.html',
+ {'categories': categories})
def library(request):
categories = Category.objects.all()
- return render(request, 'fossee_manim/library.html', {'categories': categories})
+ return render(request,
+ 'fossee_manim/library.html',
+ {'categories': categories})
def libraryMath(request):
categories = Category.objects.all()
- return render(request, 'fossee_manim/libraryMath.html', {'categories': categories})
+ return render(request,
+ 'fossee_manim/libraryMath.html',
+ {'categories': categories})
def libraryPhys(request):
categories = Category.objects.all()
- return render(request, 'fossee_manim/libraryPhys.html', {'categories': categories})
+ return render(request,
+ 'fossee_manim/libraryPhys.html',
+ {'categories': categories})
def libraryCS(request):
categories = Category.objects.all()
- return render(request, 'fossee_manim/libraryCS.html', {'categories': categories})
+ return render(request,
+ 'fossee_manim/libraryCS.html',
+ {'categories': categories})