mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-12-01 05:54:01 +03:00
Improved comments to better explain the need for auto-completion
This commit is contained in:
parent
aac479c48b
commit
6459b929f5
|
@ -104,10 +104,11 @@ class FormResource(Resource):
|
||||||
to be populated when an empty dict is supplied in `data`
|
to be populated when an empty dict is supplied in `data`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Autocompleet fields if they have a default value set in the model.
|
# Auto-complete fields with the default value on a POST request.
|
||||||
# Otherwise, what's the point of having a default value in the model if
|
#
|
||||||
# they aren't used during form validation.
|
# While Django web forms have auto-populate, POST requests in REST
|
||||||
# A better place for this would be in Django forms or db module.
|
# should have auto-complete. Otherwise, what's the point
|
||||||
|
# of having a default value.
|
||||||
method = self.view._method if hasattr(self.view, '_method') else None
|
method = self.view._method if hasattr(self.view, '_method') else None
|
||||||
if 'POST' == method and hasattr(self.model, '_meta'):
|
if 'POST' == method and hasattr(self.model, '_meta'):
|
||||||
data_mutable = data.copy()
|
data_mutable = data.copy()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user