class AddictionUpdate(PermissionRequiredMixin, UpdateView):
model = Addiction
form_class = AddictionForm
template_name = 'addiction_update.html'
permission_required = 'clientapp.change_addiction'
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/76F251D2-A429-4700-9F69-053673BDB91F%40hotmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei2korG5V3dDcCUQuKiAhG6tzAz%3DJZssNpGJpkAOyKAXpQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CE5F73B1-38EC-435B-A7B8-61F143B5C1F2%40hotmail.com.
Vijay, think of this is a parent - child relationship. I have 37K parents. Now I want to update a child of one of the parents. But, in order to have the update work, it needs the ForeignKey to the parent in the form. However, to add that key, Django must then allow it to update that field and thus has to fill in all 37K entries. Is there no way to tell Django that the FK relationship can not be changed? If I leave it off of the form, the update fails because it is a required field. If I add it to the form, Django has to allow all potential update values to be shown. What’s the way out of this mess?
Thanks,Jim
Begin forwarded message:
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei3%2B5NV3Hb5rxO-VYYGbfxRzo1Fi8-mJbXLDFFVpYTrAEg%40mail.gmail.com.
You can keep the field, but change its widget to a HiddenInput.
https://stackoverflow.com/questions/6862250/change-a-django-form-field-to-a-hidden-field
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei2LYt6JFBXUUCVNRAer-LdL69q9y2_Muxk-mmah1z0bAw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2aafdf9d6360491a83da7d5839234e68%40ISS1.ISS.LOCAL.
It’s important that you set the widget to a HiddenInput. It only has to render it with the current value. If you are keeping the widget to be a Select widget and then setting a CSS class to make it hidden, the system will still have to load all 37K values. I guess I’m missing something in your explanation.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/25286DDB-941D-408E-96E4-85D634A9EC5C%40hotmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/84e8c6364ac8455285b5a13f75e0044c%40ISS1.ISS.LOCAL.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/FF1B4F5D-AE22-400E-9CB9-2820AF131749%40hotmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1C757A10-580D-4ECC-B8E9-B1657BB83687%40gmail.com.