I'm using `setattr()` to set attributes of a new object of a Django model.

    obj = apps.get_model(app_label="theme", model_name="MyModel")
    setattr(obj,"myCol",100)
    obj.save()


I got this error: `TypeError: unbound method save() must be called with 
DataPopulationTracts2016 instance as first argument (got nothing instead)`.

I want to save the new instance of `MyModel` to the model, using 
`get_model()` and `setattr()` to make a new instance of the model and set 
its attributes. How do I make `get_model()` and `setattr()` work with 
`save()`?

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/d1e137f5-c415-45e2-9d7c-965fb3a3eb02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to