是否有可能使django的(v1.2)URLField輸出爲HTML5 input
標籤,其中type="url"
?Django URLField和HTML5?
------------- -------------解決方案
from django.forms import ModelForm
from django.forms import widgets
from django.forms import fields
from models import MyObj
class URLInput(widgets.Input):
input_type = 'url'
class MyObjForm(ModelForm):
url = fields.URLField(widget=URLInput())
class Meta:
model = MyObj
[Django的車票#16630](https://code.djangoproject.com/ticket/16630)正在進行中添加這個功能給Django本身。 – 2012-05-04 13:58:08