Ahh, I've worked out that if I overwrite the created property with `model.created = oldmodel.joined` and call `.save()` a second time it will work. Cheers folks!
On Monday, 24 September 2018 10:37:11 UTC-7, Chris Routh wrote: > > 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 [email protected]. To post to this group, send email to [email protected]. 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/82748218-b28a-4a15-809b-fe16c61fc9e0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

