def run(): for u in User.objects.all(): try: s = UserSettings.objects.get(user=u) except UserSettings.DoesNotExist: s = UserSettings(user=u, settings=DEFAULT_USER_SETTINGS) s.save()
def handle(self, *args, **options): "handle command line" for u in User.objects.all(): try: s = UserSettings.objects.get(user=u) except UserSettings.DoesNotExist: s = UserSettings(user=u, settings=DEFAULT_USER_SETTINGS) s.save()