I am building a simple django application for user feedback. And I have 
created a form for that purpose.

Here is the snippet:
# my_app/forms.py

from django import forms
import datetime
class UserQueryForm(forms.Form):
    date = forms.DateField(initial=datetime.date.today) # need help
    username = forms.CharField(label='Username:', max_length=15)
    mobilenos = forms.CharField(max_length=10, label='Mobile Nos')

And here is my template:
<form action="" method="POST">
    {% csrf_token %}
    {{ form.date }}
    {{ form.username.label}}
    {{ form.username }}
    <br />
    {{ form.mobilenos.label}}
    {{ form.mobilenos}}
    <br />
    <input type="submit" value="Submit">

I would like to initialize the *date *so that it is automatically set to 
today's date when the page loads.
All suggestions are welcomed.



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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to