You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_django/containers/services.py

14 lines
414 B
Python

from containers.models import Container
def get_container_for_booking(booking):
filters = {
'expedited': False,
}
if booking.container_number:
filters['container_number'] = booking.container_number
else:
filters['container_type'] = booking.container_type
filters['line'] = booking.line
return Container.objects.filter(**filters).order_by('created_at').first()