rebelstuff

Keep track of your stuff
git clone https://git.ce9e.org/rebelstuff.git

commit
d0d37fce10c8eb87e29d0f4f545a31c32b223224
parent
77ca8a5709e90c0e279a67e915b67125a13479d2
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-08-23 09:43
always count delivered bookings as unavailable

Diffstat

M rebelstuff/models.py 14 ++++++++++----

1 files changed, 10 insertions, 4 deletions


diff --git a/rebelstuff/models.py b/rebelstuff/models.py

@@ -17,12 +17,18 @@ class Stuff(models.Model):
   17    17         if day is None:
   18    18             day = datetime.date.today()
   19    19 
   -1    20         bookings = Booking.objects.filter(
   -1    21             models.Q(status='delivered') |
   -1    22             models.Q(
   -1    23                 ~models.Q(status='returned'),
   -1    24                 start__lte=day,
   -1    25                 end__gt=day,
   -1    26             )
   -1    27         )
   -1    28 
   20    29         items = BookingItem.objects.filter(
   21    -1             booking__start__lte=day,
   22    -1             booking__end__gt=day,
   -1    30             booking__in=bookings,
   23    31             stuff=self,
   24    -1         ).exclude(
   25    -1             booking__status='returned',
   26    32         )
   27    33 
   28    34         if exclude_item_pk: