-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
HiddenField shows up in the HTML form of the web browsable API page #2410
Comments
I am using version 3.0.3 |
Not sure if intentional, but HiddenFields aren't handled in HTMLFormRenderer. |
Yup looks valid to me. |
Thanks for raising this. |
@tomchristie submitting a fix... |
This could be misleading because I tried to fill in the username of some other user in the form field to see if I could create a category owned by that user. But it created with the user as the currently logged in user. |
Agreed - it is misleading yup. We def shouldn't be displaying the field - it won't be being used. |
Is this really fixed? I have updated DRF to 3.0.4 but my hidden fields keep appearing as before for some reason. I've already checked that the changes from the commit closing this issue have been applied, so I have no idea what's wrong with my environment. |
Yes, I can confirm that this fix does not work. |
Closed via #2580 |
I have a model with a foreign key reference to the User model called 'user'. In my serializer class, which is a sub-class of ModelSerializer, I have overridden the default field created by ModelSerializer and set it to:
When displaying the fields in the API response, this field is indeed hidden, but in the web browsable API page, the HTML form shows a textbox for the user field which is supposed to be hidden.
Here is my serializer definition:
Please see the screenshot illustrating the HTML form with an input for the hidden field.
I am totally new to Django REST Framework, so sorry if I haven't RTFM and raised this issue.
The text was updated successfully, but these errors were encountered: