diff options
author | Alwin1847207 | 2019-11-04 17:03:10 +0530 |
---|---|---|
committer | Alwin1847207 | 2019-11-04 17:03:10 +0530 |
commit | 7c650b158109a9d59882365d26f0327390268f13 (patch) | |
tree | 1140bf6b65c75b9b175adb08d9206104f60104a5 | |
parent | 9a63fcaff0974fa6401d48c5dae53782f50c4ddc (diff) | |
parent | cfdc41deed280bddbcc6c3cf45e30f33ea139e88 (diff) | |
download | FOSSEE_animations-7c650b158109a9d59882365d26f0327390268f13.tar.gz FOSSEE_animations-7c650b158109a9d59882365d26f0327390268f13.tar.bz2 FOSSEE_animations-7c650b158109a9d59882365d26f0327390268f13.zip |
removed merge conflicts
-rw-r--r-- | .idea/.gitignore | 6 | ||||
-rw-r--r-- | .idea/FOSSEE_animations.iml | 31 | ||||
-rw-r--r-- | .idea/dataSources.xml | 33 | ||||
-rw-r--r-- | .idea/inspectionProfiles/profiles_settings.xml | 6 | ||||
-rw-r--r-- | .idea/misc.xml | 7 | ||||
-rw-r--r-- | .idea/modules.xml | 8 | ||||
-rw-r--r-- | .idea/vcs.xml | 6 | ||||
-rw-r--r-- | fossee_manim/forms.py | 119 | ||||
-rw-r--r-- | fossee_manim/models.py | 140 | ||||
-rw-r--r-- | fossee_manim/static/css/index.css | 10 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/about.html | 15 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/base.html | 152 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/faqs.html | 5 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/honorarium.html | 15 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/index.html | 14 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/logout.html | 10 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/outreach.html | 7 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/proposal_status.html | 38 | ||||
-rw-r--r-- | fossee_manim/urls.py | 16 | ||||
-rw-r--r-- | fossee_manim/views.py | 370 |
20 files changed, 750 insertions, 258 deletions
diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..3889a9e --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,6 @@ + +# Default ignored files +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml
\ No newline at end of file diff --git a/.idea/FOSSEE_animations.iml b/.idea/FOSSEE_animations.iml new file mode 100644 index 0000000..201c35f --- /dev/null +++ b/.idea/FOSSEE_animations.iml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="PYTHON_MODULE" version="4"> + <component name="FacetManager"> + <facet type="django" name="Django"> + <configuration> + <option name="rootFolder" value="$MODULE_DIR$" /> + <option name="settingsModule" value="fossee_anime/settings.py" /> + <option name="manageScript" value="$MODULE_DIR$/manage.py" /> + <option name="environment" value="<map/>" /> + <option name="doNotUseTestRunner" value="false" /> + <option name="trackFilePattern" value="migrations" /> + </configuration> + </facet> + </component> + <component name="NewModuleRootManager"> + <content url="file://$MODULE_DIR$" /> + <orderEntry type="jdk" jdkName="Python 2.7" jdkType="Python SDK" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> + <component name="TemplatesService"> + <option name="TEMPLATE_CONFIGURATION" value="Django" /> + <option name="TEMPLATE_FOLDERS"> + <list> + <option value="$MODULE_DIR$/fossee_manim/templates" /> + </list> + </option> + </component> + <component name="TestRunnerService"> + <option name="PROJECT_TEST_RUNNER" value="Unittests" /> + </component> +</module>
\ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..4ab70d8 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> + <data-source source="LOCAL" name="db" uuid="3317de75-8f14-4f8c-8836-39847d18f321"> + <driver-ref>sqlite.xerial</driver-ref> + <synchronize>true</synchronize> + <jdbc-driver>org.sqlite.JDBC</jdbc-driver> + <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/db.sqlite3</jdbc-url> + <driver-properties> + <property name="enable_load_extension" value="true" /> + </driver-properties> + <libraries> + <library> + <url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.25.1/sqlite-jdbc-3.25.1.jar</url> + </library> + <library> + <url>file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.25.1/license.txt</url> + </library> + </libraries> + </data-source> + <data-source source="LOCAL" name="Django default" uuid="ae398c8c-5a45-44f5-9195-355716353d9a"> + <driver-ref>sqlite.xerial</driver-ref> + <synchronize>true</synchronize> + <imported>true</imported> + <remarks>$PROJECT_DIR$/fossee_anime/settings.py</remarks> + <jdbc-driver>org.sqlite.JDBC</jdbc-driver> + <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/db.sqlite3</jdbc-url> + <driver-properties> + <property name="enable_load_extension" value="true" /> + </driver-properties> + </data-source> + </component> +</project>
\ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ +<component name="InspectionProjectProfileManager"> + <settings> + <option name="USE_PROJECT_PROFILE" value="false" /> + <version value="1.0" /> + </settings> +</component>
\ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..f99b311 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="JavaScriptSettings"> + <option name="languageLevel" value="ES6" /> + </component> + <component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7" project-jdk-type="Python SDK" /> +</project>
\ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3dd842f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/FOSSEE_animations.iml" filepath="$PROJECT_DIR$/.idea/FOSSEE_animations.iml" /> + </modules> + </component> +</project>
\ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project>
\ No newline at end of file diff --git a/fossee_manim/forms.py b/fossee_manim/forms.py index af2b96e..b7555fc 100644 --- a/fossee_manim/forms.py +++ b/fossee_manim/forms.py @@ -1,9 +1,11 @@ from django import forms from django.utils import timezone +from taggit.forms import TagWidget + 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 +23,7 @@ PWD_CHARS = letters + punctuation + digits position_choices = ( ("contributor", "Contributor"), ("reviewer", "Reviewer") - ) +) department_choices = ( ("computer", "Dept. of Computer Science/Engg."), @@ -36,7 +38,7 @@ department_choices = ( ("electronics", "Dept. of Electronics"), ("energy science and engineering", "Dept. of Energy Science and Engg"), ("others", "Others") - ) +) title = ( ("Professor", "Prof."), @@ -47,7 +49,7 @@ title = ( ("Mr", "Mr."), ("Mrs", "Mrs."), ("Miss", "Ms."), - ) +) source = ( ("FOSSEE Email", "FOSSEE Email"), @@ -56,46 +58,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 +113,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 +135,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 +218,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 +234,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,18 +258,18 @@ 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 fields = ['category', 'subcategory', 'title', 'outline', 'tags'] + widgets = { + 'tags': TagWidget(), + } class CommentForm(forms.ModelForm): diff --git a/fossee_manim/models.py b/fossee_manim/models.py index a6f68c2..3470115 100644 --- a/fossee_manim/models.py +++ b/fossee_manim/models.py @@ -13,7 +13,7 @@ import subprocess position_choices = ( ("contributor", "Contributor"), ("reviewer", "Reviewer") - ) +) department_choices = ( ("computer", "Computers"), @@ -29,7 +29,7 @@ department_choices = ( ("electronics", "Electronics"), ("energy science and engineering", "Energy Science and Engineering"), ("others", "Others") - ) +) title = ( ("Professor", "Prof."), @@ -40,7 +40,7 @@ title = ( ("Mr", "Mr."), ("Mrs", "Mrs."), ("Miss", "Ms."), - ) +) source = ( ("FOSSEE website", "FOSSEE website"), @@ -48,46 +48,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") +) status = ( ("pending", "Pending Acceptance"), @@ -107,6 +107,7 @@ def attachments(instance, filename): instance.animation.title, str(instance.animation.id), filename) + def validate_file_extension(value): import os from django.core.exceptions import ValidationError @@ -124,13 +125,13 @@ class Profile(models.Model): institute = models.CharField(max_length=150, blank=True) department = models.CharField(max_length=150, choices=department_choices) phone_number = models.CharField( - max_length=10, - validators=[RegexValidator( - regex=r'^.{10}$', message=( - "Phone number must be entered \ + max_length=10, + validators=[RegexValidator( + regex=r'^.{10}$', message=( + "Phone number must be entered \ in the format: '9999999999'.\ Up to 10 digits allowed.") - )], null=False) + )], null=False) position = models.CharField(max_length=32, choices=position_choices, default='contributor') how_did_you_hear_about_us = models.CharField(max_length=255, blank=True, @@ -140,21 +141,21 @@ class Profile(models.Model): state = models.CharField(max_length=255, choices=states, default="IN-MH") pincode = models.CharField(max_length=6, blank=True, validators=[RegexValidator( - regex=r'^.{6}$', message=( - "Please enter valid PINCODE" - ) - )]) + regex=r'^.{6}$', message=( + "Please enter valid PINCODE" + ) + )]) is_email_verified = models.BooleanField(default=False) activation_key = models.CharField(max_length=255, blank=True, null=True) key_expiry_time = models.DateTimeField(blank=True, null=True) def __str__(self): return u"id: {0}| {1} {2} | {3} ".format( - self.user.id, - self.user.first_name, - self.user.last_name, - self.user.email - ) + self.user.id, + self.user.first_name, + self.user.last_name, + self.user.email + ) class Category(models.Model): @@ -166,11 +167,20 @@ class Category(models.Model): return u"{0}".format(self.name) +# test +class Example(models.Model): + name = models.CharField(max_length=20) + tags = TaggableManager() + + class Animation(models.Model): title = models.CharField(max_length=255) contributor = models.ForeignKey(User, on_delete=models.CASCADE) - reviewer = models.ForeignKey(User, null=True, on_delete=models.CASCADE, - related_name="%(app_label)s_%(class)s_related") + reviewer = models.ForeignKey( + User, + null=True, + on_delete=models.CASCADE, + related_name="%(app_label)s_%(class)s_related") outline = models.TextField() # concepts = models.TextField() # audience=models.TextField() @@ -205,16 +215,20 @@ class AnimationStats(models.Model): like = models.PositiveIntegerField(default=0) dislike = models.PositiveIntegerField(default=0) thumbnail = models.ImageField(null=True, blank=True, upload_to=attachments) - video_path = models.FileField(null=True, blank=True, upload_to=attachments, validators=[validate_file_extension]) + video_path = models.FileField( + null=True, + blank=True, + upload_to=attachments, + validators=[validate_file_extension]) def _create_thumbnail(self): video_path = self.video_path.path img_output = path.join( - tempfile.mkdtemp(), "{0}.jpg".format(self.animation.title) - ) + tempfile.mkdtemp(), "{0}.jpg".format(self.animation.title) + ) file_name = "{0}.jpg".format(self.animation.title) subprocess.call(['ffmpeg', '-i', video_path, '-ss', '00:00:02.000', - '-vframes', '1', img_output]) + '-vframes', '1', img_output]) if path.exists(img_output): que_file = open(img_output, 'rb') # Converting to Python file object with @@ -225,8 +239,8 @@ class AnimationStats(models.Model): def _create_ogv(self): video_input = self.video_path.path vid_output = path.join( - tempfile.mkdtemp(), "{0}.ogv".format(self.animation.title) - ) + tempfile.mkdtemp(), "{0}.ogv".format(self.animation.title) + ) file_name = "{0}.ogv".format(self.animation.title) subprocess.call(['ffmpeg', '-i', video_input, '-r', '24', vid_output]) if path.exists(vid_output): diff --git a/fossee_manim/static/css/index.css b/fossee_manim/static/css/index.css index 54bda1b..9840f69 100644 --- a/fossee_manim/static/css/index.css +++ b/fossee_manim/static/css/index.css @@ -62,7 +62,7 @@ form.example::after { } #btns { - padding: 25 25 25 25; + padding:25 25 25 25; font-size: 155%; font-family: 'Lato', sans-serif; } @@ -128,8 +128,16 @@ hr { .footer{ right: 0; left: 0; +<<<<<<< HEAD bottom: 0; padding: 1rem; +======= + position: relative; + bottom: 0; + + owerflow: hidden; + padding: 95px; +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 text-align: center; } a{ diff --git a/fossee_manim/templates/fossee_manim/about.html b/fossee_manim/templates/fossee_manim/about.html index 21c55d5..4688740 100644 --- a/fossee_manim/templates/fossee_manim/about.html +++ b/fossee_manim/templates/fossee_manim/about.html @@ -5,10 +5,16 @@ About {% endblock %} {% block content %} +<<<<<<< HEAD <div class="container-fluid jumbotron" align="justify" style="margin-top:20px; padding:50px; background-color: transparent;"> <!-- style="padding-top:120px"> --> <center> +======= + <div class="container-fluid jumbotron" align = "justify" style="margin-top:20px; margin-bottom: 56px; padding:50px; background-color: transparent;"> + {% comment %}style="padding-top:120px"> {% endcomment %} + <center> +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 <h1>About FOSSEE Animations</h1> <h4 style="color: #555555;"><i>What</i> do we do and <i>why</i>?</h4> </center> @@ -16,5 +22,12 @@ About <div class="container" style="font-family: 'Lato', sans-serif; background-color: #e7edee;"> <hr> </div> +<<<<<<< HEAD </div> -{% endblock content %}
\ No newline at end of file +{% endblock content %} +======= + <div> + {% endblock content %} + </div> + +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 diff --git a/fossee_manim/templates/fossee_manim/base.html b/fossee_manim/templates/fossee_manim/base.html index ab5fa06..ae45a6a 100644 --- a/fossee_manim/templates/fossee_manim/base.html +++ b/fossee_manim/templates/fossee_manim/base.html @@ -34,82 +34,92 @@ <body> {% block header %} +<<<<<<< HEAD <nav class="navbar navbar-expand-md row fixed-top" style="background-color:#222222; padding-top: 20px; padding-bottom: 20px;"> +======= + <nav class="navbar navbar-expand-lg " style="background-color:#222222; color: white;"> +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 <a class="navbar-brand" href="{% url 'index' %}"> - <img src="{{ URL_ROOT }}/static/img/logo_main.png" width="150" height="33.75" alt="" style="margin-right: 50px; margin-left: 20px"> + <img src="{{ URL_ROOT }}/static/img/logo_main.png" width="200" height="50" alt="" + style="margin-right: 50px; margin-left: 20px"> </a> - <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> - <span class="navbar-toggler-icon"></span> + + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" + aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> + <span class="fa fa-bars" style="color:white;"></span> </button> - <ul class="navbar-nav"> - <li class="nav-item dropdown"> - <div class="collapse navbar-collapse" id="navbarSupportedContent"> - <i class="material-icons md-24" style="color: #1facb3;"> - explore - </i> - <a class="nav-link dropdown-toggle" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="color:#1fabc3"> Explore</a> - - <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink"> - {% for c in categories %} - <a class="dropdown-item" href="{% url 'explore' c.name %}">{{c.name}}</a> - <div class="dropdown-divider"> - </div> - {% endfor %} - </div> - </li> - </ul> + <div class="collapse navbar-collapse" id="navbarSupportedContent"> + <ul class="navbar-nav mr-auto"> + <li class="nav-item active"> + <a class="btn" href="{% url 'about' %}">About</a> + </li> + <li class="nav-item active"> + <a class="btn" href="{% url 'guidelines' %}">Guidelines</a> + </li> + <li class="nav-item active"> + <a class="btn" href="{% url 'faqs' %}">FAQ</a> + </li> + <li class="nav-item active"> + <a class="btn" href="{% url 'honorarium' %}">Honorarium</a> + </li> + <li class="nav-item active"> + <a class="btn" href="{% url 'send_proposal' %}"><b>Submit Proposal</b></a> + </li> + <li class="nav-item active"> + <a class="btn" href="{% url 'outreach' %}">Outreach</a> + </li> + <li class="nav-item active"> + <a class="btn" href="{% url 'library' %}">Library</a> + </li> + {% if user.is_authenticated %} + {% if request.user.profile.position == 'contributor' %} + + <li class="nav-item active"> + <a class="btn" href="{% url 'proposal_status' %}">Proposal Status</a> + </li> + + {% else %} + + <li class="nav-item active"> + <a class="btn" href="{% url 'proposal_status' %}">Submitted Proposals</a> + </li> + {% endif %} + + <li class="nav-item active"> + <a class="btn" href="{% url 'view_profile' %}">View Profile</a> + </li> + + <li class="nav-item active"> + <a class="btn" href="{% url 'logout' %}">Logout</a> + </li> + {% else %} + + <li class="nav-item active"> + <a class="btn" href="{% url 'login' %}">Login</a> + </li> + + <li class="nav-item active"> + <a class="btn" href="{% url 'register' %}">Register</a> + </li> + {% endif %} + </ul> <form class="form-inline" method="POST" action="/search/" style="margin-left: 10px; margin-top: 10px; "> {% csrf_token %} - <input class="form-control mr-sm-2" type="search" id="sbox" name="sbox" placeholder="Search for animations"> - <button class="btn btn-primary my-2 my-sm-0" id= "btnblue" type="submit"> + <input class="form-control mr-sm-2" type="search" id="sbox" name="sbox" + placeholder="Search for animations"> + <button class="btn btn-primary my-2 my-sm-0" id="btnblue" type="submit"> Search - </button> + </button> </form> - <ul class="navbar-nav ml-md-auto"> - <li class="nav-item dropdown"> - {% if user.is_authenticated %} - <a class="nav-link dropdown-toggle" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="color:white"> {{user.first_name}}</a> - <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink"> - {% if request.user.profile.position == 'contributor' %} - <a class="dropdown-item" href="{% url 'proposal_status' %}">Proposal Status</a> - {% else %} - <a class="dropdown-item" href="{% url 'proposal_status' %}">Submitted Proposals</a> - {% endif %} - <div class="dropdown-divider"> - </div> - <a class="dropdown-item" href="{% url 'view_profile' %}">View Profile</a> - <div class="dropdown-divider"> - </div> - <a class="dropdown-item" href="{% url 'logout' %}">Logout</a> - </div> - {% else %} - <a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" style="color:white">Login / Register</a> - <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink"> - <a class="dropdown-item" href="{% url 'login' %}">Login</a> - <div class="dropdown-divider"> - </div> - <a class="dropdown-item" href="{% url 'register' %}">Register</a> - </div> - {% endif %} - </li> - </ul> - </div> - </nav> - <!-- <nav class="navbar navbar-expand-md navbar-dark bg-dark"> --> - - <div class="jumbotron sticky-top" style="padding-top: 90px; padding-bottom: 0.2%; margin-bottom: 0px; background-color: #dddddd;width:auto"> - <div class="btn-group btn-group-lg" role="group"> - <button class="btn btn-link perma_link" type="button"><a href="{% url 'about' %}" style="color:#157b80">About</a></button> - <button class="btn btn-link perma_link" type="button"><a href="{% url 'guidelines' %}" style="color:#222222">Guidelines</a></button> - <button class="btn btn-link perma_link" type="button"><a href="{% url 'faqs' %}" style="color:#222222">FAQ</a></button> - <button class="btn btn-link perma_link" type="button"><a href="{% url 'honorarium' %}" style="color:#222222">Honorarium</a></button> - <button class="btn btn-link perma_link" type="button"><a href="{% url 'send_proposal' %}" style="color:#dd1100"><b>Submit Proposal</b></a></button> - <button class="btn btn-link perma_link" type="button"><a href="{% url 'outreach' %}" style="color:#222222">Outreach</a></button> - <button class="btn btn-link perma_link" type="button"><a href="{% url 'library' %}" style="color:#222222">Library</a></button> </div> +<<<<<<< HEAD </div> +======= + </nav> + +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 {% endblock %} {% block content %} @@ -120,7 +130,12 @@ <!-- </main> --> {% block footer %} +<<<<<<< HEAD <footer class="footer" style="background-color: #222222; font-family: 'Lato', sans-serif; padding:30px;"> +======= + <footer class="page-footer"> + <div class="footer" style="background-color: #222222; font-family: 'Lato', sans-serif; padding:95px;"> +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 <div class="container"> <div class="row"> <div class="col-md-4 text-center"> @@ -151,11 +166,20 @@ This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License </div> </div> +<<<<<<< HEAD </footer> {% endblock footer %} <!-- START Bootstrap-Alert +======= + </div> + </footer> + + {% endblock footer %} + <!-- + START Bootstrap-Alert +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 <div class="alert text-center cookiealert" role="alert" style="background: #d1ff3c; color: black;"> The website is currently undergoing some developmental changes. If you encounter any glitches, write to us at animations@fossee.in ; we value your feedback and suggestions ! diff --git a/fossee_manim/templates/fossee_manim/faqs.html b/fossee_manim/templates/fossee_manim/faqs.html index ab25f41..f22f79b 100644 --- a/fossee_manim/templates/fossee_manim/faqs.html +++ b/fossee_manim/templates/fossee_manim/faqs.html @@ -139,8 +139,13 @@ FAQs </ul> <br> +<<<<<<< HEAD <h5>If you have any other queries, email us at <a href="mailto: animations@fossee.in">animations@fossee.in</a> </h2> </div> +======= + <h5>If you have any other queries, email us at <a href="mailto: animations@fossee.in">animations@fossee.in</a> </h5> +</div> +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 </div> {% endblock %}
\ No newline at end of file diff --git a/fossee_manim/templates/fossee_manim/honorarium.html b/fossee_manim/templates/fossee_manim/honorarium.html index 968ff87..b844482 100644 --- a/fossee_manim/templates/fossee_manim/honorarium.html +++ b/fossee_manim/templates/fossee_manim/honorarium.html @@ -64,6 +64,7 @@ Honorarium you do not receive your money within 45 days of acknowledgement of forms received, please feel free to contact us; we are happy to assist you.</li> </ol> +<<<<<<< HEAD <p><span>Please note that the honorarium processing only starts after we receive your completed honorarium forms. Ensure that you have made a PAN card and submit the forms in time to avoid delays.</span> <p> @@ -82,6 +83,20 @@ Honorarium Form </a> </li> <li> <a href="https://static.fossee.in/animations/forms/Receipt.pdf"> Receipt </a> </li> </ul> +======= + <p><span>Please note that the honorarium processing only starts after we receive your completed honorarium forms. Ensure that you have made a PAN card and submit the forms in time to avoid delays.</span><p> + <br> <br> + <h2><center>Forms</center></h2> + <br> + <p>Kindly print out the forms below, fill the required fields and mail them to the address:<p> + <ul> + <li> <a style="color: blue" href = "https://static.fossee.in/animations/forms/Copyright_Transfer.pdf"> Copyright Transfer Form </a> </li> + <li> <a style="color: blue" href = "https://static.fossee.in/animations/forms/Contributor_Details.pdf"> Contributor Details Form </a> </li> + <li> <a style="color: blue" href = "https://static.fossee.in/animations/forms/Bank_Details.pdf"> Bank Details Form </a> </li> + <li> <a style="color: blue" href = "https://static.fossee.in/animations/forms/Receipt.pdf"> Receipt </a> </li> + </ul> + </div> +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 </div> </div> {% endblock %}
\ No newline at end of file diff --git a/fossee_manim/templates/fossee_manim/index.html b/fossee_manim/templates/fossee_manim/index.html index bdfca1c..23d7d66 100644 --- a/fossee_manim/templates/fossee_manim/index.html +++ b/fossee_manim/templates/fossee_manim/index.html @@ -63,6 +63,7 @@ FOSSEE Animations Homepage <!--Infographics--> +<<<<<<< HEAD <div class="jumbotron row text-center" id="infg" style="background-color: white; margin: 10px; font-family:'Lato', sans-serif; font-weight:400"> <div class="container text-center"> @@ -74,4 +75,15 @@ FOSSEE Animations Homepage style="background-color:#157b80; color:white;">Guidelines</a> page! </div> </div> -{% endblock %}
\ No newline at end of file +{% endblock %} +======= + <div class="jumbotron row text-center" id= "infg" style="background-color: white; margin: 10px; font-family:'Lato', sans-serif; font-weight:400"> + <div class="container text-center"> + <h1 style="color: #e45700; font-family:'Montserrat', sans-serif;">HOW IT WORKS</h1> + <img class="img-fluid d-block text-center" width="100%" src="{{ URL_ROOT }}/static/img/info.svg" alt="Infographic"> + <br> + Want to know more? Visit our <button onclick="location.href='{{URL_ROOT}}/guidelines/'" style="background-color:#157b80; color:white;">Guidelines</button> page! + </div> + </div> + {% endblock %} +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 diff --git a/fossee_manim/templates/fossee_manim/logout.html b/fossee_manim/templates/fossee_manim/logout.html index ef071f9..61b2f68 100644 --- a/fossee_manim/templates/fossee_manim/logout.html +++ b/fossee_manim/templates/fossee_manim/logout.html @@ -5,6 +5,7 @@ Logged out {% endblock %} +<<<<<<< HEAD {% block content %} <div class="container jumbotron" align="center" style="margin-top: 30px;"> <br> @@ -12,5 +13,14 @@ Logged out <h4>If you want to Login again please <a href="{{ URL_ROOT}}/login/">click here</a></h4> <br> </div> +======= + {% block content %} + <div class="container jumbotron" align="center" style= "margin-top: 30px;"> + <br> + <h3>You have logged out successfully.</h3> + <h4>If you want to Login again please <a href="{{ URL_ROOT}}/login/" style="color: blue">click here</a></h4> + <br> + </div> +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 {% endblock %}
\ No newline at end of file diff --git a/fossee_manim/templates/fossee_manim/outreach.html b/fossee_manim/templates/fossee_manim/outreach.html index 0cb6ee5..f0314eb 100644 --- a/fossee_manim/templates/fossee_manim/outreach.html +++ b/fossee_manim/templates/fossee_manim/outreach.html @@ -5,11 +5,18 @@ FOSSEE Animations | Outreach {% endblock %} {% block content %} +<<<<<<< HEAD <div class="container-fluid jumbotron" align="justify" style="background-color: transparent"> <center> <h2>FOSSEE Animations Outreach</h2> </center> <hr> </div> +======= + <div class="container-fluid jumbotron" align = "justify" style="background-color: transparent; margin-bottom: 103px; "> + <center><h2>FOSSEE Animations Outreach</h2></center> + <hr> + </div> +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 {% 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 c41a195..e7c8f35 100644 --- a/fossee_manim/templates/fossee_manim/proposal_status.html +++ b/fossee_manim/templates/fossee_manim/proposal_status.html @@ -8,6 +8,7 @@ <div class="jumbotron" style="background-color: white; margin-top: 0px;"> <div class="container" align="center"> +<<<<<<< HEAD <h2> Proposal Status </h2> <hr> <table class="table table-hover" style="font-family: 'Lato', sans-serif;"> @@ -53,6 +54,43 @@ {% endfor %} </table> </div> +======= + <h2> Proposal Status </h2> + <hr> + <table class="table table-hover" style= "font-family: 'Lato', sans-serif;"> + <thead> + <tr> + <th>Title</th> + <th>Status</th> + <th>Created Date</th> + {% if request.user.profile.position == 'reviewer' %} + <th>Contributor Name</th> + + {% endif %} + </tr> + </thead> + {% for an in anime %} + <tbody> + <tr> + <td>{{ an.title }}</td> + {% if an.status == 'rejected' %} + <td><span class="text-danger">{{ an.status }}</span></td> + {% elif an.status == 'released' %} + <td><span class="text-success">{{ an.status }}</span></td> + {% else %} + <td><span class="text-info">{{ an.status }}</span></td> + {% endif %} + <td><span class="badge">{{ an.created }}</span></td> + {% if request.user.profile.position == 'reviewer' %} + <td>{{ an.contributor.get_full_name }}</td> + {% endif %} + <td><a href="{% url 'edit_proposal' an.id %}"><button type="button" class="btn btn-info" id= "btnblue">Edit</button></a></td> + </tr> + </tbody> + {% endfor %} + </table> + </div> +>>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 <!-- Page Navigation --> diff --git a/fossee_manim/urls.py b/fossee_manim/urls.py index 1947cba..d7b228b 100644 --- a/fossee_manim/urls.py +++ b/fossee_manim/urls.py @@ -26,12 +26,12 @@ 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'), @@ -39,6 +39,6 @@ urlpatterns = [ ] 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 faa93b9..3ea851e 100644 --- a/fossee_manim/views.py +++ b/fossee_manim/views.py @@ -2,7 +2,8 @@ from os import listdir, path, sep, makedirs, remove from .forms import ( UserRegistrationForm, UserLoginForm, ProfileForm, AnimationProposal, - CommentForm, UploadAnimationForm + CommentForm, UploadAnimationForm, + AnimationProposal_edit ) from .models import ( Profile, User, AnimationStats, @@ -35,9 +36,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 +58,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 +70,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 +93,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 +126,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 +161,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 +205,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 +236,7 @@ def view_profile(request): try: logout(request) return redirect('/login/') - except: + except BaseException: return redirect('/register/') @@ -246,7 +257,7 @@ def edit_profile(request): try: logout(request) return redirect('/login/') - except: + except BaseException: return redirect('/register/') context = {'template': template} @@ -274,9 +285,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 +320,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) @@ -336,24 +347,161 @@ def proposal_status(request): @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': + animations = Animation.objects.filter( + contributor_id=user, status='released').order_by('-created') + else: + 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/') + + +@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': + animations = Animation.objects.filter( + contributor_id=user, status='rejected').order_by('-created') + else: + 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/') + + +@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': + animations = Animation.objects.filter( + contributor_id=user, status='changes').order_by('-created') + else: + 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/') + + +@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': + animations = Animation.objects.filter( + contributor_id=user, status='pending').order_by('-created') + else: + 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 edit_proposal(request, proposal_id=None): user = request.user if is_email_checked(user) and user.is_authenticated(): comment_form = CommentForm() proposal = Animation.objects.get(id=proposal_id) - proposal_form = AnimationProposal(instance=proposal) + proposal_form = AnimationProposal_edit(instance=proposal) upload_form = UploadAnimationForm() 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') @@ -393,7 +541,8 @@ def edit_proposal(request, proposal_id=None): proposal=proposal) form_data.save() return redirect('/edit_proposal/{}'.format(proposal_id)) - proposal_form = AnimationProposal(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 @@ -429,39 +578,85 @@ def edit_proposal(request, proposal_id=None): @login_required -def delete_proposal(request, proposal_id=None): +def show_proposal_detail(request, proposal_id=None): user = request.user 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}) + try: + proposal = Animation.objects.get(id=proposal_id) + return render(request, 'fossee_manim/delete_proposal.html', {'proposal': proposal}) + except: + 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') + else: + animations = Animation.objects.order_by('-created') + + paginator = Paginator(list(animations), 9) + page = request.GET.get('page') + try: + anime = paginator.page(page) + print(animations.count(), anime) + except PageNotAnInteger: + anime = paginator.page(1) + except EmptyPage: + anime = paginator.page(paginator.num_pages) + + return render(request, 'fossee_manim/proposal_status.html', + {'anime': anime, + 'categories': categories}) else: return redirect('/register/') @login_required -def delete_proposal_info(request, proposal_id=None): +def delete_proposal(request, proposal_id=None): user = request.user if is_email_checked(user) and user.is_authenticated(): - proposal = Animation.objects.get(id=proposal_id) - proposal.delete() - 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') - else: - animations = Animation.objects.order_by('-created') - paginator = Paginator(list(animations), 9) - page = request.GET.get('page') try: - anime = paginator.page(page) - print(animations.count(), anime) - except PageNotAnInteger: - anime = paginator.page(1) - except EmptyPage: - anime = paginator.page(paginator.num_pages) + proposal = Animation.objects.get(id=proposal_id) + proposal.delete() + 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') + else: + animations = Animation.objects.order_by('-created') + paginator = Paginator(list(animations), 9) + page = request.GET.get('page') + try: + anime = paginator.page(page) + print(animations.count(), anime) + except PageNotAnInteger: + anime = paginator.page(1) + except EmptyPage: + anime = paginator.page(paginator.num_pages) + + return render(request, 'fossee_manim/proposal_status.html', {'anime': anime, 'categories': categories}) + except: + 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') + else: + animations = Animation.objects.order_by('-created') - return render(request, 'fossee_manim/proposal_status.html',{'anime': anime,'categories': categories}) + paginator = Paginator(list(animations), 9) + page = request.GET.get('page') + try: + anime = paginator.page(page) + print(animations.count(), anime) + except PageNotAnInteger: + anime = paginator.page(1) + except EmptyPage: + anime = paginator.page(paginator.num_pages) + + return render(request, 'fossee_manim/proposal_status.html', + {'anime': anime, + 'categories': categories}) else: return redirect('/login/') @@ -471,13 +666,44 @@ 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(): + profile = Profile.objects.get(user_id=user) + categories = Category.objects.all() + word = request.POST.get('sbox') + animations = Animation.objects.filter(title=word) + 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 upload_animation(request, proposal_id=None): @@ -495,7 +721,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() @@ -506,7 +732,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)) @@ -526,7 +752,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 @@ -569,44 +795,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}) |