Hi all,
I've created a ModelForm and am attempting to use it, but all of my date
fields are coming up with type "text" instead of a datepicker. Can anybody
tell me what's going on?
MODEL:
class GIS_WO(models.Model):
WON = models.CharField(max_length=7, blank=True, null=True)
status = models.CharField(max_length=20)
priority = models.IntegerField()
location = models.CharField(max_length=200)
deadline = models.DateField(blank=True, null=True)
type = models.CharField(max_length=50)
notes = models.CharField(max_length=512, blank=True, null=True)
creation_timestamp = models.DateTimeField(auto_now_add=True, null=True)
update_timestamp = models.DateTimeField(auto_now=True, null=True)
start_dt = models.DateTimeField(blank=True, null=True)
end_dt = models.DateTimeField(blank=True, null=True)
def __unicode__(self):
return unicode(self.id)
ModelForm:
class GIS_WO_Form(ModelForm):
class Meta:
model = GIS_WO
VIEW:
def detail(request, id):
wo = get_object_or_404(GIS_WO, pk=id)
form = GIS_WO_Form(instance=wo)
return render_to_response('GIS_WO_APP/detail.html', {'form': form},
context_instance=RequestContext(request))
OUTPUT:
<form action="" method="post">
<tr><th><label for="id_WON">WON:</label></th><td><input id="id_WON"
type="text" name="WON" value="C-13001" maxlength="7" /></td></tr>
<tr><th><label for="id_status">Status:</label></th><td><input
id="id_status" type="text" name="status" value="OPEN" maxlength="20"
/></td></tr>
<tr><th><label for="id_priority">Priority:</label></th><td><input
type="text" name="priority" value="1" id="id_priority" /></td></tr>
<tr><th><label for="id_location">Location:</label></th><td><input
id="id_location" type="text" name="location" value="MY HOUSE"
maxlength="200" /></td></tr>
<tr><th><label for="id_deadline">Deadline:</label></th><td><input
type="text" name="deadline" value="2013-04-06" id="id_deadline" /></td></tr>
<tr><th><label for="id_type">Type:</label></th><td><input id="id_type"
type="text" name="type" value="New Constructions" maxlength="50"
/></td></tr>
<tr><th><label for="id_notes">Notes:</label></th><td><input id="id_notes"
type="text" name="notes" value="Some Notes" maxlength="512" /></td></tr>
<tr><th><label for="id_start_dt">Start dt:</label></th><td><input
type="text" name="start_dt" id="id_start_dt" /></td></tr>
<tr><th><label for="id_end_dt">End dt:</label></th><td><input type="text"
name="end_dt" id="id_end_dt" /></td></tr>
</form>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.