From 164aa3c9c7e0202ad0c5d58f01bdc18f884c023c Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 13 Sep 2020 20:09:59 +0000 Subject: [PATCH] Stop checking old_models.py on registration --- apiserver/apiserver/api/utils.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/apiserver/apiserver/api/utils.py b/apiserver/apiserver/api/utils.py index 9382f89..c82b22a 100644 --- a/apiserver/apiserver/api/utils.py +++ b/apiserver/apiserver/api/utils.py @@ -19,11 +19,6 @@ from django.core.cache import cache from django.utils.timezone import now, pytz from . import models, serializers, utils_ldap -try: - from . import old_models -except ImportError: - logger.info('Running without old portal data...') - old_models = None STATIC_FOLDER = 'data/static/' @@ -292,10 +287,6 @@ def link_old_member(data, user): Since this runs AFTER registration, we need to delete the user on any failures or else the username will be taken when they try again ''' - if not old_models: - msg = 'Unable to link, old DB wasn\'t imported.' - logger.info(msg) - raise ValidationError(dict(email=msg)) try: member = models.Member.objects.get(old_email__iexact=data['email']) @@ -342,12 +333,11 @@ def link_old_member(data, user): models.Training.objects.filter(member_id=member.id).update(user=user) def create_new_member(data, user): - if old_models: - old_members = old_models.Members.objects.using('old_portal') - if old_members.filter(email__iexact=data['email']).exists(): - msg = 'Account was found in old portal.' - logger.info(msg) - raise ValidationError(dict(email=msg)) + members = models.Member.objects + if members.filter(old_email__iexact=data['email']).exists(): + msg = 'Account was found in old portal.' + logger.info(msg) + raise ValidationError(dict(email=msg)) if utils_ldap.is_configured(): result = utils_ldap.find_user(user.username)