rebelstuff

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

commit
a84ed7dfd7610eabb12fdf5bb0e59cc75760bdee
parent
d60a29a775467f642bce5e9401e4690b059de4cc
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-08-22 23:38
add booking status

Diffstat

M rebelstuff/admin.py 3 ++-
A rebelstuff/migrations/0002_booking_status.py 22 ++++++++++++++++++++++
M rebelstuff/models.py 9 ++++++++-

3 files changed, 32 insertions, 2 deletions


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

@@ -23,9 +23,10 @@ class BookingItemInline(admin.TabularInline):
   23    23 
   24    24 
   25    25 class BookingAdmin(admin.ModelAdmin):
   26    -1     list_display = ['name', 'start', 'end']
   -1    26     list_display = ['name', 'start', 'end', 'status']
   27    27     date_hierarchy = 'start'
   28    28     search_fields = ['name']
   -1    29     list_filter = ['status']
   29    30     inlines = [BookingItemInline]
   30    31 
   31    32 

diff --git a/rebelstuff/migrations/0002_booking_status.py b/rebelstuff/migrations/0002_booking_status.py

@@ -0,0 +1,22 @@
   -1     1 # Generated by Django 2.2.4 on 2019-08-23 00:42
   -1     2 
   -1     3 from django.db import migrations, models
   -1     4 
   -1     5 
   -1     6 class Migration(migrations.Migration):
   -1     7 
   -1     8     dependencies = [
   -1     9         ('rebelstuff', '0001_initial'),
   -1    10     ]
   -1    11 
   -1    12     operations = [
   -1    13         migrations.AlterModelOptions(
   -1    14             name='booking',
   -1    15             options={'ordering': ['-start', '-end', 'status', 'name']},
   -1    16         ),
   -1    17         migrations.AddField(
   -1    18             model_name='booking',
   -1    19             name='status',
   -1    20             field=models.CharField(choices=[('waiting', 'waiting'), ('delivered', 'delivered'), ('returned', 'returned')], default='waiting', max_length=16, verbose_name='Status'),
   -1    21         ),
   -1    22     ]

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

@@ -21,6 +21,8 @@ class Stuff(models.Model):
   21    21             booking__start__lte=day,
   22    22             booking__end__gte=day,
   23    23             stuff=self,
   -1    24         ).exclude(
   -1    25             booking__status='returned',
   24    26         )
   25    27 
   26    28         if exclude_item_pk:
@@ -36,9 +38,14 @@ class Booking(models.Model):
   36    38     contact = models.TextField(_('Contact'), blank=True)
   37    39     start = models.DateField(_('Start'))
   38    40     end = models.DateField(_('End'))
   -1    41     status = models.CharField(_('Status'), choices=[
   -1    42         ('waiting', _('waiting')),
   -1    43         ('delivered', _('delivered')),
   -1    44         ('returned', _('returned')),
   -1    45     ], max_length=16, default='waiting')
   39    46 
   40    47     class Meta:
   41    -1         ordering = ['-start', '-end', 'name']
   -1    48         ordering = ['-start', '-end', 'status', 'name']
   42    49 
   43    50     def __str__(self):
   44    51         return self.name