mirror of
https://github.com/django/django.git
synced 2025-01-22 08:10:28 +00:00
Fixed bug in dynamically-generated docs -- ForeignKeys were throwing an exception
git-svn-id: http://code.djangoproject.com/svn/django/trunk@182 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
cf4c164e9f
commit
12c04fbf29
@ -275,6 +275,7 @@ DATA_TYPE_MAPPING = {
|
|||||||
'EmailField' : 'E-mail address',
|
'EmailField' : 'E-mail address',
|
||||||
'FileField' : 'File path',
|
'FileField' : 'File path',
|
||||||
'FloatField' : 'Decimal number',
|
'FloatField' : 'Decimal number',
|
||||||
|
'ForeignKey' : 'Integer',
|
||||||
'ImageField' : 'File path',
|
'ImageField' : 'File path',
|
||||||
'IntegerField' : 'Integer',
|
'IntegerField' : 'Integer',
|
||||||
'IPAddressField' : 'IP address',
|
'IPAddressField' : 'IP address',
|
||||||
@ -293,6 +294,9 @@ DATA_TYPE_MAPPING = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def get_readable_field_data_type(field):
|
def get_readable_field_data_type(field):
|
||||||
|
# ForeignKey is a special case. Use the field type of the relation.
|
||||||
|
if field.__class__.__name__ == 'ForeignKey':
|
||||||
|
field = field.rel.get_related_field()
|
||||||
return DATA_TYPE_MAPPING[field.__class__.__name__] % field.__dict__
|
return DATA_TYPE_MAPPING[field.__class__.__name__] % field.__dict__
|
||||||
|
|
||||||
def extract_views_from_urlpatterns(urlpatterns, base=''):
|
def extract_views_from_urlpatterns(urlpatterns, base=''):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user