1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from allauth.socialaccount.models import SocialAccount
6 from django.core.management.base import BaseCommand
10 'facebook': ['link', 'name', 'id', 'locale', 'timezone', 'updated_time', 'verified'],
11 'google': ['name', 'picture', 'locale', 'id', 'verified_email', 'link'],
15 class Command(BaseCommand):
16 def handle(self, *args, **options):
17 for provider, kept_fields in KEPT_FIELDS.iteritems():
18 for sa in SocialAccount.objects.filter(provider=provider):
19 trimmed_data = {k: v for k, v in sa.extra_data.iteritems() if k in kept_fields}
20 sa.extra_data = trimmed_data