1👍
✅
Run a SQL query in your favorite database manager that creates records for all the existing User
records.
0👍
Instead of doing from MySql you could also do it from the django shell
. Access all the records from the old user base as a query list and then create a my_object
for them. As answered above there is no need for setting the signal, as the task has to be done only once. Also such an app based signal, if possible would be more cumbersome to do.
old_users = Old_users.objects.all() for user in old_users:
object = my_object(user = user)
object.save()
By the way, how have you added the old users to django user
?
- [Answer]-Convert django function generic view into class-based generic view
- [Answer]-Passing variables to a Django template
- [Answer]-Django gets unnecessary fields executing QuerySet
- [Answer]-Importing data into Django richtextfield is losing line breaks formatting
- [Answer]-Separate image name from image path
Source:stackexchange.com