Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_current_tag_owner(uid):
from accesscontrol.models import User
not_expired_users = User.objects.filter(rfidtaguserlink__expire_date__gte=datetime.date.today())
never_expire_users = User.objects.filter(rfidtaguserlink__expire_date__isnull=True)
all_valid_users = not_expired_users | never_expire_users
print(all_valid_users)
return all_valid_users.get(rfid_tag__uid=uid.lower())
def get_current_tag_owner(uid):
from accesscontrol.models import User
not_expired_users = User.objects.filter(rfidtaguserlink__expire_date__gte=datetime.date.today())
never_expire_users = User.objects.filter(rfidtaguserlink__expire_date__isnull=True)
all_valid_users = not_expired_users | never_expire_users
print(all_valid_users)
return all_valid_users.get(rfid_tag__uid=uid.lower())