Skip to content
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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

yasinrawther
Copy link

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 in settings.py. And also show max_length field in table representation. Sample output I attached here.
fields_table_repr

@@ -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 '-')
Copy link

@soraphis soraphis Jan 25, 2018

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)

Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants