Skip to content

Commit

Permalink
#241 Delete related SocialAccounts
Browse files Browse the repository at this point in the history
  • Loading branch information
viliambalaz committed Jun 9, 2020
1 parent b7eecba commit c11d6a0
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.contrib.sites.models import Site
from django.db import models, migrations


def forward(apps, schema_editor):
SocialApp = apps.get_model(u'socialaccount', u'SocialApp')
SocialApp.objects.filter(pk__in=[3, 4]).delete()
SocialAccount = apps.get_model(u'socialaccount', u'SocialAccount')
SocialApp.objects.filter(provider__in=[u'twitter', 'linkedin']).delete()
SocialAccount.objects.filter(provider__in=[u'twitter', u'linkedin']).delete()

def backward(apps, schema_editor):
SocialApp = apps.get_model(u'socialaccount', u'SocialApp')
twitter = SocialApp.objects.create(pk=3, provider=u'twitter', name=u'Twitter OAuth')
twitter.sites.add(1)
linkedin = SocialApp.objects.create(pk=4, provider=u'linkedin', name=u'Linkedin OAuth')
linkedin.sites.add(1)
site = Site.objects.get_current()
twitter = SocialApp.objects.create(provider=u'twitter', name=u'Twitter OAuth')
twitter.sites.add(site.pk)
linkedin = SocialApp.objects.create(provider=u'linkedin', name=u'Linkedin OAuth')
linkedin.sites.add(site.pk)

class Migration(migrations.Migration):

Expand Down

0 comments on commit c11d6a0

Please sign in to comment.