Skip to content

Commit

Permalink
use log instead of print...
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloodmallet committed Apr 26, 2019
1 parent 0a941d3 commit 6f75e1a
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions bloodmallet/general_website/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.contrib.auth.models import AbstractUser
from django.utils.translation import gettext_lazy as _

from allauth.socialaccount.signals import pre_social_login, social_account_updated
from allauth.socialaccount.signals import pre_social_login, social_account_updated, social_account_added

from enum import Enum

Expand Down Expand Up @@ -37,24 +37,36 @@ def can_create_chart(self) -> bool:


@receiver([pre_social_login, social_account_updated])
def update_pledge_level(sender, sociallogin, **kwargs):
"""Checks kwargs for pledge level in account data.
def update_pledge_level(request, sociallogin, **kwargs):
"""
Checks kwargs for pledge level in account data.
TODO: Add actual functionality to grab patreon level
Find info here:
https://www.patreon.com/portal/registration/register-clients
https://docs.patreon.com/#third-party-libraries
patreons own lib https://github.com/Patreon/patreon-python
https://django-allauth.readthedocs.io/en/latest/signals.html#allauth-socialaccount
Arguments:
sender {[type]} -- [description]
sociallogin {[type]} -- [description]
sender {[type]} -- Model
sociallogin {[type]} -- instance
"""

print(sender)
print(sociallogin)
logger.debug(request)
logger.debug(sociallogin)
try:
logger.debug(request.account) # read social allauth models.py
except Exception:
logger.debug("No social.account could be found yet. Probably linking in progress.")
try:
print(sociallogin.account) # read social allauth models.py
# here lies the data package
logger.debug(sociallogin.account.extra_data) # read social allauth models.py
except Exception:
print("No social.account could be found yet. Probably linking in progress.")
logger.debug("No social.account could be found yet. Probably linking in progress.")


#https://stackoverflow.com/questions/40684838/django-django-allauth-save-extra-data-from-social-login-in-signal
# https://stackoverflow.com/questions/40684838/django-django-allauth-save-extra-data-from-social-login-in-signal


@receiver(user_logged_in)
Expand Down

0 comments on commit 6f75e1a

Please sign in to comment.