Refactor rolling stock

This commit is contained in:
2022-03-30 23:15:24 +02:00
parent 91e6dd0cac
commit fd76b2df28
25 changed files with 600 additions and 17 deletions

View File

@@ -16,9 +16,7 @@ def addresschecker(f):
Check if DCC address does exist in the database
"""
def addresslookup(request, address, *args):
try:
RollingStock.objects.get(address=address)
except RollingStock.DoesNotExist:
if not RollingStock.objects.filter(address=address):
raise Http404
return f(request, address, *args)
return addresslookup