我的网址字段有以下代码:
model = MyModel()
field = model._meta.get_field_by_name('my_url_field')[0]
my_type = field.get_internal_type()
print my_type
打印:
CharField
如何获取URLField的django值?
答案 0 :(得分:2)
似乎达到你想要的唯一方法就是这样做:
>>> model = MyModel()
>>> field = model._meta.get_field_by_name('my_url_field')[0]
>>> print field.__class__.__name__
'URLField'