Skip to content

Commit

Permalink
#241 Define SITE_ID constant
Browse files Browse the repository at this point in the history
  • Loading branch information
viliambalaz committed Jun 9, 2020
1 parent c11d6a0 commit 97d01a7
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

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


SITE_ID = 1

def forward(apps, schema_editor):
SocialApp = apps.get_model(u'socialaccount', u'SocialApp')
SocialAccount = apps.get_model(u'socialaccount', u'SocialAccount')
Expand All @@ -13,11 +14,10 @@ def forward(apps, schema_editor):

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

class Migration(migrations.Migration):

Expand Down

0 comments on commit 97d01a7

Please sign in to comment.