In my case, I'm using `setattr()` because I need to access a field via 
string and set it. I can't do `obj.myCol = "blah blah"` because this whole 
code is part of a `manage.py` command I'm setting up that asks the user to 
input the name of the model and column they want to add a new record for.
On Tuesday, January 23, 2018 at 7:59:11 PM UTC-5, Costja Covtushenko wrote:
>
> Hi,
>
> It looks like with get_model() you’ve gotten Model class not Model 
> instance.
> You can use `save()` on instance only.
> You need to have something like:
>
> class_ = get_model(…)
> instance = class_()
> instance.save()
>
> I hope that make sense to you.
>
> Regards,
> C.
>
> On Jan 23, 2018, at 7:43 PM, Tom Tanner <dontsende...@gmail.com 
> <javascript:>> wrote:
>
> get_model
>
>
>

-- 
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/f06c409b-ca0a-4350-8736-26ad0553ab67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to