Last active
May 4, 2024 23:42
-
-
Save ianfitzpatrick/76e7f5e96de9f585fd7e4572956c73e8 to your computer and use it in GitHub Desktop.
Clean Up Bad Birthdays.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import Q | |
from profiles.models import UserProfile | |
# First remove all empty birthdays | |
# profiles = UserProfile.objects.exclude( | |
# Q(birthday_month__isnull=True) & Q(birthday_day__isnull=True) & Q(birthday_year__isnull=True) | |
# ) | |
yo = UserProfile.objects.filter( | |
birthday_month__isnull=True, birthday_day__isnull=True, | |
birthday_year__isnull=False) | |
mo = UserProfile.objects.filter( | |
birthday_month__isnull=False, birthday_day__isnull=True) | |
do = UserProfile.objects.filter( | |
birthday_month__isnull=True, birthday_day__isnull=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment