--
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+unsubscribe@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/54a3c692-3232-4032-aadd-561789b92c91%40googlegroups.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/CABuXbh-CTnYG%2BGWQXDU9o%3D1VnrNCtCzfksH%2B50M55%3Dw2Rh6Z5g%40mail.gmail.com.
You’re adding an attribute (is_staff) to the form and then saving the form, but no method is doing anything with that attribute.
When you save a model form, it will return the instance of the model. You can then proceed to change that model, and save it again.
if form.is_valid():
instance = form.save(commit=False) # get the model instance from the filled-out form without saving it to the database
instance.is_staff = True # modify the instance by changing the is_staff attribute to True
instance.save() # save the instance of the model to the database
form.save_m2m() # for handling any many-to-many relationships that are not saved when commit=False
Please review the documentation:
https://docs.djangoproject.com/en/2.0/topics/forms/modelforms/
--
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/54a3c692-3232-4032-aadd-561789b92c91%40googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.
--
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/CABuXbh-CTnYG%2BGWQXDU9o%3D1VnrNCtCzfksH%2B50M55%3Dw2Rh6Z5g%40mail.gmail.com.
For more options, visit
https://groups.google.com/d/optout.
--
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/CAMBu2whLRTmfPBNNvn5gyNrZFAtddZf3241LE%3DkJmrWjD4-HbQ%40mail.gmail.com.
--
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@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/54a3c692-3232-4032-aadd-561789b92c91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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+unsubscribe@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/CABuXbh-CTnYG%2BGWQXDU9o%3D1VnrNCtCzfksH%2B50M55%3Dw2Rh6Z5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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+unsubscribe@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/CAMBu2whLRTmfPBNNvn5gyNrZFAtddZf3241LE%3DkJmrWjD4-HbQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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+unsubscribe@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/cdbb7ed0d9d74abdbe60a71e869947df%40ISS1.ISS.LOCAL.