-
-
Save JorgeMichelena/c6cadba194cfff4cdde7ed3745acb697 to your computer and use it in GitHub Desktop.
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.utils import timezone | |
from dateutil.relativedelta import relativedelta | |
# Calculate the date to get those users who have a date_of_birth value | |
# less than it, to make sure they are 21 years old or older | |
max_datetime = timezone.now() - relativedelta(years=21) | |
queryset = q1.union(User.objects.filter(date_of_birth__lte=max_datetime)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment