summaryrefslogtreecommitdiff
path: root/arduino_blog/forms.py
diff options
context:
space:
mode:
authorPrashant S2020-03-02 11:23:14 +0530
committerGitHub2020-03-02 11:23:14 +0530
commitc8e48471348ff02f679b5185e01291f059c93e6c (patch)
treeb9cedf30374fb9a2a3b39ab739b60fc84b26bba1 /arduino_blog/forms.py
parent61c91c743fabb5c31127e8f8a8109364eda9b8ff (diff)
parentad1a740a6b70ff349b1cb1eb006d4eb8ae5c69d7 (diff)
downloadarduino_projects_website-c8e48471348ff02f679b5185e01291f059c93e6c.tar.gz
arduino_projects_website-c8e48471348ff02f679b5185e01291f059c93e6c.tar.bz2
arduino_projects_website-c8e48471348ff02f679b5185e01291f059c93e6c.zip
Merge pull request #5 from prashantsinalkar/master
updated to django 3 and added dashboard
Diffstat (limited to 'arduino_blog/forms.py')
-rw-r--r--arduino_blog/forms.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/arduino_blog/forms.py b/arduino_blog/forms.py
index ee8b6b1..35a64a2 100644
--- a/arduino_blog/forms.py
+++ b/arduino_blog/forms.py
@@ -2,6 +2,10 @@ from django import forms
from django.forms import ModelForm, widgets
+import datetime
+from dateutil.relativedelta import relativedelta
+
+
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.core.validators import MinLengthValidator, MinValueValidator, \
@@ -23,6 +27,7 @@ from arduino_blog.models import (
)
from .send_emails import (send_user_mail,
generate_activation_key)
+from arduino_blog.views import *
UNAME_CHARS = letters + "._" + digits
PWD_CHARS = letters + punctuation + digits
@@ -245,13 +250,28 @@ class AbstractProposalForm(forms.ModelForm):
error_messages={
'required': 'Abstract field required.'},
)
+
+ completion_date = forms.DateTimeField(
+ input_formats=['%YY-%mm-%dd'],
+ widget=forms.DateTimeInput(attrs={
+ 'class': 'form-control datetimepicker-input',
+ 'data-target': '#datetimepicker1'
+ })
+ )
+
terms_and_conditions = forms.BooleanField(widget=forms.CheckboxInput(),
required=True, label='I agree to the terms and conditions')
class Meta:
model = Proposal
- exclude = ('user','name_of_author', 'email', 'status', 'rate')
+ exclude = ('user','name_of_author', 'email', 'status', 'rate','proposal_status', 'approval_date')
+
+ def __init__(self, *args, **kwargs):
+ super(AbstractProposalForm, self).__init__(*args, **kwargs)
+ self.fields['completion_date'].disabled = True
+ self.fields['completion_date'].initial = (datetime.date.today() + relativedelta(months=1)).strftime("%Y-%m-%d")
+
def clean_attachment(self):
import os
cleaned_data = self.cleaned_data