diff options
Diffstat (limited to 'website')
-rwxr-xr-x | website/forms.py | 10 | ||||
-rwxr-xr-x | website/templates/abstract-details.html | 2 | ||||
-rwxr-xr-x | website/templates/comment-abstract.html | 4 | ||||
-rwxr-xr-x | website/views.py | 15 |
4 files changed, 17 insertions, 14 deletions
diff --git a/website/forms.py b/website/forms.py index fdf6bc2..ed0fe90 100755 --- a/website/forms.py +++ b/website/forms.py @@ -70,8 +70,7 @@ class ProposalForm(forms.ModelForm): error_messages = {'required':'About me field required.'}, ) attachment = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}), - required = True, - error_messages = {'required':'Attachment field required.'},) + required = False,) phone = forms.CharField(min_length = 10, max_length = 12, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Phone'}),required=False, validators = [RegexValidator(regex = '^[0-9-_+.]*$', message='Enter a Valid Phone Number',)], # error_messages = {'required':'Title field required.'}, ) @@ -79,7 +78,7 @@ class ProposalForm(forms.ModelForm): required = True, error_messages = {'required':'Title field required.'}, ) - abstract = forms.CharField(min_length = 300, max_length = 700, widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Abstract'}), + abstract = forms.CharField(min_length = 300, widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Abstract'}), required = True, label = 'Abstract (Min. 300 char.)', error_messages = {'required':'Abstract field required.'}, @@ -118,15 +117,14 @@ class WorkshopForm(forms.ModelForm): error_messages = {'required':'About Me field required.'}, ) attachment = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}), - required = True, - error_messages = {'required':'Attachment field required.'},) + required = False,) phone = forms.CharField(min_length = 10, max_length = 12, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Phone'}),required=False, validators = [RegexValidator(regex = '^[0-9-_+.]*$', message='Enter a Valid Phone Number',)], ) title = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Title'}), required = True, error_messages = {'required':'Title field required.'}, ) - abstract = forms.CharField(min_length = 300 ,max_length = 700,widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Desciption'}), + abstract = forms.CharField(min_length = 300 ,widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Desciption'}), required = True, label = 'Description (Min. 300 char.)', error_messages = {'required':'Abstract field required.'}, diff --git a/website/templates/abstract-details.html b/website/templates/abstract-details.html index 42c5d59..daacdbe 100755 --- a/website/templates/abstract-details.html +++ b/website/templates/abstract-details.html @@ -54,7 +54,7 @@ <p><b>Prerequisite: </b> {{ proposal.prerequisite }}</p> {% endif%} <p><b>Date Created: </b> {{ proposal.date_created }}</p> - {% if proposal.attachment.url %} + {% if url %} <p><b>Attachment: </b> <a href="{{ url }}" class="btn btn-info" target="_blank">{{filename}}</a></p> {% endif %} diff --git a/website/templates/comment-abstract.html b/website/templates/comment-abstract.html index 27b1837..992ae91 100755 --- a/website/templates/comment-abstract.html +++ b/website/templates/comment-abstract.html @@ -60,7 +60,7 @@ {% if proposal.prerequisite %} <p><b>Prerequisite: </b> {{ proposal.prerequisite }}</p> {% endif%} - {% if proposal.attachment.url %} + {% if url %} <b>Attachment: </b> <a href="{{ url }}" class="btn btn-info" target="_blank">{{ filename }}</a> {% endif %} <p><b>Date Created: </b> {{ proposal.date_created }}</p> @@ -111,7 +111,7 @@ {% endfor %} <form action="{% url 'website:comment_abstract' proposal.id %}" method='POST' enctype="multipart/form-data"> {% csrf_token %} - <textarea rows="5" cols="100" id="comment" class= "comment" name="comment" placeholder = "Add commnet here..."></textarea><br> + <textarea rows="5" cols="100" id="comment" class= "comment" name="comment" placeholder = "Add commnet here..."></textarea><br/> <input class="button special" style="background:#d44727" type="submit" value="Comment"> </form> diff --git a/website/views.py b/website/views.py index b45896c..c8c5212 100755 --- a/website/views.py +++ b/website/views.py @@ -311,11 +311,14 @@ def abstract_details(request, proposal_id=None): proposal = Proposal.objects.get(id=proposal_id) print "------------------> owner",proposal.user if proposal.user == user: - url = '/2016'+str(proposal.attachment.url) + try: + url = '/2016'+str(proposal.attachment.url) + context['url'] = url + except: + pass comments = Comments.objects.filter(proposal=proposal) context['proposal'] = proposal context['user'] = user - context['url'] = url context['comments'] = comments path, filename = os.path.split(str(proposal.attachment)) context['filename'] = filename @@ -373,7 +376,11 @@ def comment_abstract(request, proposal_id = None): if user.is_authenticated(): if user.is_superuser : proposal = Proposal.objects.get(id=proposal_id) - url = '/2016'+str(proposal.attachment.url) + try: + url = '/2016'+str(proposal.attachment.url) + context['url'] = url + except: + pass if request.method == 'POST': comment = Comments() comment.comment = request.POST['comment'] @@ -423,7 +430,6 @@ def comment_abstract(request, proposal_id = None): context['rates'] = rates context['proposal'] = proposal context['comments'] = comments - context['url'] = url path, filename = os.path.split(str(proposal.attachment)) context['filename'] = filename context.update(csrf(request)) @@ -433,7 +439,6 @@ def comment_abstract(request, proposal_id = None): rates = Ratings.objects.filter(proposal=proposal) context['rates'] = rates context['proposal'] = proposal - context['url'] = url context['comments'] = comments path, filename = os.path.split(str(proposal.attachment)) context['filename'] = filename |