Skip to content

Commit

Permalink
For some reason, these proiles keep getting
Browse files Browse the repository at this point in the history
removed from their useres.  this mgmt command fixes that
  • Loading branch information
owocki committed Jan 7, 2019
1 parent 1ea5957 commit 44b0141
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/dashboard/management/commands/cleanup_dupe_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'''

from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.db.models import Count
from django.db.models.functions import Lower
Expand Down Expand Up @@ -123,3 +124,14 @@ def handle(self, *args, **options):
profile.hide_profile = False
profile.save()
print(profile.handle)

# KO Hack 2019/01/07
# For some reason, these proiles keep getting
# removed from their useres. this mgmt command fixes that
for user in User.objects.filter(profile__isnull=True):
profiles = Profile.objects.filter(handle__iexact=user.username)
if profiles.exists():
print(user.username)
profile = profiles.first()
profile.user = user
profile.save()

0 comments on commit 44b0141

Please sign in to comment.