#28793: AttributeError: 'ModelName' object has no attribute 'save_m2m'
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  Anjaneyulu                         |
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  Forms      |        Version:  1.11
               Severity:  Release    |       Keywords:  manytomany,
  blocker                            |  modelform save, attribute error
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 instance = form.save(commit=False)
 instance.updated_by = self.request.user
 instance.save()
 instance.save_m2m()

 I'm getting below error. Django version 1.11.6

 AttributeError: 'ModelName' object has no attribute 'save_m2m'

 But in documentation
 https://docs.djangoproject.com/en/1.11/topics/forms/modelforms/

 every time you save a form using commit=False, Django adds a save_m2m()
 method to your ModelForm subclass. After you’ve manually saved the
 instance produced by the form, you can invoke save_m2m() to save the many-
 to-many form data.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28793>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.2c30e76534d26108ca717b2e6e0b9801%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to