Skip to content

Instantly share code, notes, and snippets.

@ianfitzpatrick
Last active May 4, 2024 23:42
Show Gist options
  • Save ianfitzpatrick/76e7f5e96de9f585fd7e4572956c73e8 to your computer and use it in GitHub Desktop.
Save ianfitzpatrick/76e7f5e96de9f585fd7e4572956c73e8 to your computer and use it in GitHub Desktop.
Clean Up Bad Birthdays.md
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