@register.filter
def astrological_sign(bday):
if bday.month == 1 and bday.day >= 20 or bday.month == 2 and bday.day < 18:
return 'aquarius'
if bday.month == 2 and bday.day >= 18 or bday.month == 3 and bday.day < 20:
return 'pisces'
if bday.month == 3 and bday.day >= 20 or bday.month == 4 and bday.day < 20:
return 'aries'
if bday.month == 4 and bday.day >= 20 or bday.month == 5 and bday.day < 21:
return 'taurus'
if bday.month == 5 and bday.day >= 21 or bday.month == 6 and bday.day < 21:
return 'gemini'
if bday.month == 6 and bday.day >= 21 or bday.month == 7 and bday.day < 22:
return 'cancer'
if bday.month == 7 and bday.day >= 22 or bday.month == 8 and bday.day < 23:
return 'leo'
if bday.month == 8 and bday.day >= 23 or bday.month == 9 and bday.day < 23:
return 'virgo'
if bday.month == 9 and bday.day >= 23 or bday.month == 10 and bday.day < 23:
return 'libra'
if bday.month == 10 and bday.day >= 23 or bday.month == 11 and bday.day < 22:
return 'scorpio'
if bday.month == 11 and bday.day >= 22 or bday.month == 12 and bday.day < 22:
return 'sagittarius'
return 'capricorn'

## Comments

Here is a more pythonic version:

#

Great filter macat. Great version willhardy!

#