diff options
-rw-r--r-- | fossee_manim/forms.py | 190 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/base.html | 20 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/index.html | 15 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/logout.html | 12 | ||||
-rw-r--r-- | fossee_manim/templates/fossee_manim/proposal_status.html | 114 | ||||
-rw-r--r-- | fossee_manim/urls.py | 11 | ||||
-rw-r--r-- | fossee_manim/views.py | 2 |
7 files changed, 202 insertions, 162 deletions
diff --git a/fossee_manim/forms.py b/fossee_manim/forms.py index b7555fc..7cc1971 100644 --- a/fossee_manim/forms.py +++ b/fossee_manim/forms.py @@ -1,11 +1,9 @@ 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 @@ -23,7 +21,7 @@ PWD_CHARS = letters + punctuation + digits position_choices = ( ("contributor", "Contributor"), ("reviewer", "Reviewer") -) + ) department_choices = ( ("computer", "Dept. of Computer Science/Engg."), @@ -38,7 +36,7 @@ department_choices = ( ("electronics", "Dept. of Electronics"), ("energy science and engineering", "Dept. of Energy Science and Engg"), ("others", "Others") -) + ) title = ( ("Professor", "Prof."), @@ -49,7 +47,7 @@ title = ( ("Mr", "Mr."), ("Mrs", "Mrs."), ("Miss", "Ms."), -) + ) source = ( ("FOSSEE Email", "FOSSEE Email"), @@ -58,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): @@ -113,8 +111,7 @@ 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()) @@ -135,9 +132,7 @@ 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) @@ -218,11 +213,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 @@ -234,7 +229,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) @@ -258,18 +253,91 @@ 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') + } + + class Meta: + model = Animation + widgets = { + 'sketch': forms.FileInput(), + } + fields = ['category', 'subcategory', 'title', 'outline', 'tags'] + + +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')} + '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': ('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: model = Animation - fields = ['category', 'subcategory', 'title', 'outline', 'tags'] widgets = { - 'tags': TagWidget(), + 'sketch': forms.FileInput(), } + fields = ['category', 'subcategory', 'title', 'outline', 'tags', 'concepts', 'audience', 'reference', 'tools', + 'detaled_description', 'link', 'sketch'] class CommentForm(forms.ModelForm): @@ -299,4 +367,4 @@ class UploadAnimationForm(forms.ModelForm): exclude = ['animation', 'views', 'like', 'dislike', 'thumbnail'] widgets = { 'video_path': forms.FileInput(), - } + }
\ No newline at end of file diff --git a/fossee_manim/templates/fossee_manim/base.html b/fossee_manim/templates/fossee_manim/base.html index ae45a6a..5e6326e 100644 --- a/fossee_manim/templates/fossee_manim/base.html +++ b/fossee_manim/templates/fossee_manim/base.html @@ -34,11 +34,7 @@ <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="200" height="50" alt="" style="margin-right: 50px; margin-left: 20px"> @@ -114,12 +110,8 @@ </form> </div> -<<<<<<< HEAD - </div> -======= </nav> ->>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 {% endblock %} {% block content %} @@ -130,12 +122,8 @@ <!-- </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"> @@ -166,20 +154,12 @@ 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/index.html b/fossee_manim/templates/fossee_manim/index.html index 23d7d66..1e902e9 100644 --- a/fossee_manim/templates/fossee_manim/index.html +++ b/fossee_manim/templates/fossee_manim/index.html @@ -63,20 +63,6 @@ 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"> - <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 <a href="{{URL_ROOT}}/guidelines/" - style="background-color:#157b80; color:white;">Guidelines</a> page! - </div> -</div> -{% 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> @@ -86,4 +72,3 @@ FOSSEE Animations Homepage </div> </div> {% endblock %} ->>>>>>> cfdc41deed280bddbcc6c3cf45e30f33ea139e88 diff --git a/fossee_manim/templates/fossee_manim/logout.html b/fossee_manim/templates/fossee_manim/logout.html index 61b2f68..fe816a4 100644 --- a/fossee_manim/templates/fossee_manim/logout.html +++ b/fossee_manim/templates/fossee_manim/logout.html @@ -5,22 +5,12 @@ Logged out {% endblock %} -<<<<<<< HEAD {% 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/">click here</a></h4> + <h4>If you want to Login again please <a href="{{ URL_ROOT}}/login/" style="color: blue">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/proposal_status.html b/fossee_manim/templates/fossee_manim/proposal_status.html index e7c8f35..81af9ec 100644 --- a/fossee_manim/templates/fossee_manim/proposal_status.html +++ b/fossee_manim/templates/fossee_manim/proposal_status.html @@ -8,9 +8,54 @@ <div class="jumbotron" style="background-color: white; margin-top: 0px;"> <div class="container" align="center"> -<<<<<<< HEAD <h2> Proposal Status </h2> <hr> + <div class="row"> + <!-- + This filtering section contains + 1. Search option for the submitted proposal + 2. Select the proposals who ahve the status Rejected + 3. Select the proposals who ahve the status Released + 4. Select the proposals who ahve the status Changes + 5. Select the proposals who ahve the status Pending + --> + <div class="col-md-4"> + <form class="form-inline" method="POST" action="/search_proposal/"> + {% csrf_token %} + <input class="form-control mr-sm-2" type="search" id="sbox" name="sbox" + placeholder="Search for proposals"> + <button class="btn btn-primary my-2 my-sm-0" id="btnblue" type="submit"> + Search + </button> + </form> + </div> + + <div class="col-md-2"> + <a href="{% url 'sortproposal_rejected' %}"> + <button type="button" class="btn btn-info" id="btnred">Rejected</button> + </a> + </div> + + <div class="col-md-2"> + <a href="{% url 'sortproposal_released' %}"> + <button type="button" class="btn btn-info" id="btnred">Released</button> + </a> + </div> + + <div class="col-md-2"> + <a href="{% url 'sortproposal_changes' %}"> + <button type="button" class="btn btn-info" id="btnred">Changes</button> + </a> + </div> + + <div class="col-md-2"> + <a href="{% url 'sortproposal_pending' %}"> + <button type="button" class="btn btn-info" id="btnred">Pending</button> + </a> + </div> + <!-- end of filtering section --> + </div> + <hr> <table class="table table-hover" style="font-family: 'Lato', sans-serif;"> <thead> <tr> @@ -19,7 +64,6 @@ <th>Created Date</th> {% if request.user.profile.position == 'reviewer' %} <th>Contributor Name</th> - <th>Mail Status</th> {% endif %} </tr> </thead> @@ -35,62 +79,30 @@ <td><span class="text-info">{{ an.status }}</span></td> {% endif %} <td><span class="badge">{{ an.created }}</span></td> + <td> + {% if request.user.profile.position == 'reviewer' %} + {{ an.contributor.get_full_name }} + {% endif %} + </td> + <td> + {% if an.status == 'released' or an.status == 'changes' or request.user.profile.position == 'reviewer'%} + <a href="{% url 'edit_proposal' an.id %}"> + <button type="button" class="btn btn-info" + id="btnblue">Edit + </button> + </a> + {% endif %} + </td> {% if request.user.profile.position == 'reviewer' %} - <td>{{ an.contributor.get_full_name }}</td> - <td>{{ an.contributor.get_full_name }}</td> + <td><a href="{% url 'delete_proposal' an.id %}"> + <button type="button" class="btn btn-info" id="btnred">Delete</button> + </a></td> {% endif %} - <td><a href="{% url 'edit_proposal' an.id %}"> - <button type="button" class="btn btn-info" - id="btnblue">Edit - </button> - </a></td> - {% if request.user.profile.position == 'reviewer' %} - <td><a href="{% url 'delete_proposal' an.id %}"> - <button type="button" class="btn btn-info" id="btnred">Delete</button> - </a></td> - {% endif %} </tr> </tbody> {% 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 d7b228b..3a9211a 100644 --- a/fossee_manim/urls.py +++ b/fossee_manim/urls.py @@ -33,9 +33,14 @@ 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'^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'), + 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 3ea851e..b8ab7b0 100644 --- a/fossee_manim/views.py +++ b/fossee_manim/views.py @@ -3,7 +3,7 @@ from .forms import ( UserRegistrationForm, UserLoginForm, ProfileForm, AnimationProposal, CommentForm, UploadAnimationForm, - AnimationProposal_edit + AnimationProposal_edit, ) from .models import ( Profile, User, AnimationStats, |