From 204f6ff6518a8aec1b4d374104616caa41713e8a Mon Sep 17 00:00:00 2001 From: Sashi20 Date: Mon, 2 Mar 2020 15:49:55 +0530 Subject: Remove attachments field from proposal form --- arduino_blog/forms.py | 20 +++----------------- .../migrations/0006_remove_proposal_attachment.py | 17 +++++++++++++++++ arduino_blog/templates/submit-cfp.html | 7 ++----- 3 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 arduino_blog/migrations/0006_remove_proposal_attachment.py (limited to 'arduino_blog') diff --git a/arduino_blog/forms.py b/arduino_blog/forms.py index 20c3d2f..4945b79 100644 --- a/arduino_blog/forms.py +++ b/arduino_blog/forms.py @@ -237,9 +237,9 @@ class AbstractProposalForm(forms.ModelForm): error_messages={ 'required': 'About the author field required.'}, ) - attachment = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}), - label='Please upload relevant documents (if any)', - required=False,) + # attachment = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}), + # label='Please upload relevant documents (if any)', + # required=False,) title_of_the_project = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Title of the Project'}), required=True, error_messages={ @@ -272,17 +272,3 @@ class AbstractProposalForm(forms.ModelForm): super(AbstractProposalForm, self).__init__(*args, **kwargs) self.fields['completion_date'].disabled = True self.fields['completion_date'].initial = (datetime.date.today() + relativedelta(months=1)) - - def clean_attachment(self): - import os - cleaned_data = self.cleaned_data - attachment = cleaned_data.get('attachment', None) - if attachment: - ext = os.path.splitext(attachment.name)[1] - valid_extensions = ['.pdf'] - if not ext in valid_extensions: - raise forms.ValidationError( - u'File not supported! Only .pdf file is accepted') - if attachment.size > (5*1024*1024): - raise forms.ValidationError('File size exceeds 5MB') - return attachment diff --git a/arduino_blog/migrations/0006_remove_proposal_attachment.py b/arduino_blog/migrations/0006_remove_proposal_attachment.py new file mode 100644 index 0000000..1cb0463 --- /dev/null +++ b/arduino_blog/migrations/0006_remove_proposal_attachment.py @@ -0,0 +1,17 @@ +# Generated by Django 3.0.3 on 2020-03-02 10:16 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('arduino_blog', '0005_auto_20200228_1241'), + ] + + operations = [ + migrations.RemoveField( + model_name='proposal', + name='attachment', + ), + ] diff --git a/arduino_blog/templates/submit-cfp.html b/arduino_blog/templates/submit-cfp.html index 988bc60..6e20b5c 100644 --- a/arduino_blog/templates/submit-cfp.html +++ b/arduino_blog/templates/submit-cfp.html @@ -43,12 +43,9 @@
+