Thanks you Melvyn, this is it :-)

Have a nice day.

Regards

Le mardi 3 juillet 2018 00:34:14 UTC+2, Melvyn Sopacua a écrit :
>
> On vrijdag 29 juni 2018 09:44:40 CEST Mickael Barbo wrote:
>
>  
>
> > I try to create a way to archive (copy) the same object instance on an
>
> > other DataBase.
>
> > 
>
> > I followed this advice : # https://stackoverflow.com/
>
> > questions/21699707/python-how-to-copy-all-attibutes-from-
>
> > base-class-to-derived-one
>
>  
>
> That advice is for normal python classes. Django models have some 
> restrictions, one being that fields are special attributes. Messing with a 
> model's __init__() is not something you normally do as a model's class 
> creation is highly customized.
>
>  
>
> If you're really using 2 different databases, a model's save() operation 
> supports a `using` keyword that allows you to select the database 
> connection 
> <https://docs.djangoproject.com/en/2.0/topics/db/multi-db/#selecting-a-database-for-save>.
>  
> Archiving becomes really easy that way.
>
>  
>
>  
>
> -- 
>
> Melvyn Sopacua
>

-- 
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/a3f21016-62ab-43cc-9c3a-164797a602c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to