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

Fixed #27068 -- Unified form field initial data retrieval. #7097

Merged
merged 1 commit into from Aug 19, 2016
Merged

Fixed #27068 -- Unified form field initial data retrieval. #7097

merged 1 commit into from Aug 19, 2016

Conversation

jdufresne
Copy link
Member

@@ -482,6 +482,12 @@ def visible_fields(self):
"""
return [field for field in self if not field.is_hidden]

def get_initial(self, field_name, field):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add docstring? No need to document this method?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if get_initial_for_field might make it more readable?

@jdufresne
Copy link
Member Author

Made adjustments based on feedback. Please review. Thanks.

@@ -482,6 +482,17 @@ def visible_fields(self):
"""
return [field for field in self if not field.is_hidden]

def get_initial_for_field(self, field, field_name):
"""
Return initial data for field on form. Return the form's initial data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the second sentence, maybe: "Use initial data from the form or the field, in that order."

@timgraham
Copy link
Member

Some tests for get_initial_for_field() might be nice.

@jdufresne
Copy link
Member Author

jdufresne commented Aug 18, 2016

Updated text based on feedback and added recommended tests. All additional feedback is welcome, thanks!

@jdufresne jdufresne merged commit f5c6d3c into django:master Aug 19, 2016
@jdufresne jdufresne deleted the unify-initial-form-data branch August 21, 2016 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants