Monday, September 24, 2018

Explicitly setting 'created' date for initial user import from legacy application

Hi all,

I need to explicitly set the created date for users when saving them during an initial import process from a legacy user table. I am using a legacy DB model and trasnforming the models and saving the new user obects. I only need to override the default create behaviour for this one import task, after that I want it to behave normally, so not sure if overriding the model save function in the model definition is appropriate.

I guess I could generate a fixture file and use call_command(loaddata...) to import the users and bypass the default save, but this seems nasty. Is there a better way?

--
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-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/83858b6a-6d78-494f-a5d5-387b34f4d9f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment