-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fields in table representation #172
base: master
Are you sure you want to change the base?
Fields in table representation #172
Conversation
…field as ul or table
… the fields in table
rest_framework_docs/api_endpoint.py
Outdated
@@ -122,7 +122,8 @@ def __get_serializer_fields__(self, serializer): | |||
"type": str(field.__class__.__name__), | |||
"sub_fields": sub_fields, | |||
"required": field.required, | |||
"to_many_relation": to_many_relation | |||
"to_many_relation": to_many_relation, | |||
"max_length": (field.__dict__.get('max_length', '-') if field.__dict__.get('max_length', '-') != None else '-') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change:
if field.__dict__.get('max_length', '-') != None else '-')
to
if field.__dict__.get('max_length', '-') is not None else '-')
(to fulfill flake8 requirements)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Committed the changes for flake8 requirements
Here I have added the feature of fields with the table representation. So you can use Table representation to make your fields list in the documentation clear. So We can change representation by adding single line inside the
REST_FRAMEWORK_DOCS
insettings.py
. And also showmax_length
field in table representation. Sample output I attached here.