date field validation

33 views
Skip to first unread message

hardik....@fafadiatech.com

unread,
Jul 15, 2014, 7:29:18 AM7/15/14
to django...@googlegroups.com
i want validation in form.py in which the datetime should not be less than datetime.now

please i need it urgently

please help me

monoBOT

unread,
Jul 15, 2014, 8:19:18 AM7/15/14
to django...@googlegroups.com
like that:

def clean_date(self):
        date = self.cleaned_data['date']

        if date < datetime.datetime.now():
            raise forms.ValidationError(_(u'Must be a future date'))
        return date


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/dda37413-d72f-4a5d-a9d8-b3ca72a4d82b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
monoBOT
Visite mi sitio(Visit my site): monobotsoft.es/blog/

hardik....@fafadiatech.com

unread,
Jul 16, 2014, 12:50:34 AM7/16/14
to django...@googlegroups.com
bro i want to check that

i want to give a appointment model

appointment is available for 6 days a week
from monday to saturday
and  from 11 am to 7pm

can you please give me this coding coz i have to submit my project today
Reply all
Reply to author
Forward
0 new messages