我有这样的形式:
class EventForm(ModelForm):
reg_due_date = forms.DateTimeField(input_formats=('%d/%m/%Y %H:%M',), widget=forms.TextInput(attrs={ 'class': 'datePicker','readonly':'true'}))
和
class Event(models.Model):
reg_due_date = models.DateTimeField()
一切都很好,当我使用 jQuery DateTimePicker 时,我在输入字段中有正确的日期时间格式。但是当我尝试通过这部分代码编辑表单时,我看到出现了几秒钟,这是完全不可接受的。它来自哪里?
def editEventInfo(request,event_id):
if request.method == 'GET':
if event_id:
event = Event.objects.get(pk=event_id)
form = EventForm(instance=event) # An unbound form
else:
form = EventForm() # An unbound form
return render_to_response('events/editEvent.html', {
'form': form,
},context_instance=RequestContext(request))