diff --git a/RIGS/forms.py b/RIGS/forms.py index 8a231da3..d008deb5 100644 --- a/RIGS/forms.py +++ b/RIGS/forms.py @@ -84,4 +84,4 @@ class EventForm(forms.ModelForm): model = models.Event fields = ['is_rig', 'name', 'venue', 'start_date', 'start_time', 'end_date', 'end_time', 'meet_at', 'access_at', 'description', 'notes', 'mic', - 'person', 'organisation', 'dry_hire', 'based_on'] \ No newline at end of file + 'person', 'organisation', 'dry_hire', 'based_on', 'checked_in_by'] \ No newline at end of file diff --git a/RIGS/models.py b/RIGS/models.py index 17bdc3d8..aba43043 100644 --- a/RIGS/models.py +++ b/RIGS/models.py @@ -175,7 +175,7 @@ class EventManager(models.Manager): status=Event.CANCELLED)) | # Ends after (models.Q(dry_hire=True, start_date__gte=datetime.date.today()) & ~models.Q( status=Event.CANCELLED)) | # Active dry hire - (models.Q(dry_hire=True, checked_in_by__isnull=False) & ( + (models.Q(dry_hire=True, checked_in_by__isnull=True) & ( models.Q(status=Event.BOOKED) | models.Q(status=Event.CONFIRMED))) | # Active dry hire GT models.Q(status=Event.CANCELLED, start_date__gte=datetime.date.today()) # Canceled but not started ).order_by('meet_at', 'start_date').select_related('person', 'organisation', 'venue', 'mic') @@ -183,14 +183,16 @@ class EventManager(models.Manager): def rig_count(self): event_count = self.filter( - models.Q(start_date__gte=datetime.date.today(), end_date__isnull=True, - is_rig=True) | # Starts after with no end - models.Q(end_date__gte=datetime.date.today(), is_rig=True) | # Ends after - models.Q(dry_hire=True, checked_in_by__isnull=False, status__lt=Event.CANCELLED, - is_rig=True) | # Active dry hire LT - models.Q(dry_hire=True, checked_in_by__isnull=False, status__gt=Event.CANCELLED, is_rig=True) - # Active dry hire GT - ).order_by('meet_at', 'start_date').count() + (models.Q(start_date__gte=datetime.date.today(), end_date__isnull=True, dry_hire=False, + is_rig=True) & ~models.Q( + status=Event.CANCELLED)) | # Starts after with no end + (models.Q(end_date__gte=datetime.date.today(), dry_hire=False, is_rig=True) & ~models.Q( + status=Event.CANCELLED)) | # Ends after + (models.Q(dry_hire=True, start_date__gte=datetime.date.today(), is_rig=True) & ~models.Q( + status=Event.CANCELLED)) | # Active dry hire + (models.Q(dry_hire=True, checked_in_by__isnull=True, is_rig=True) & ( + models.Q(status=Event.BOOKED) | models.Q(status=Event.CONFIRMED))) # Active dry hire GT + ).count() return event_count diff --git a/RIGS/templates/RIGS/event_form.html b/RIGS/templates/RIGS/event_form.html index 1701cdb1..cef48a3d 100644 --- a/RIGS/templates/RIGS/event_form.html +++ b/RIGS/templates/RIGS/event_form.html @@ -230,32 +230,44 @@ -
- -
-
- {% render_field form.start_time type="time" class+="form-control" %} +
+
+
+ +
+
+ {% render_field form.start_time type="time" class+="form-control" %} +
+
-
- -
-
- {% render_field form.end_time type="time" class+="form-control end_time" %} -
-
-
- 23:00 - 02:00 +
+
+
+ +
+
+ {% render_field form.end_time type="time" class+="form-control end_time" %} +
+
+ +
+
+
+ 23:00 + 02:00 +
+
@@ -316,6 +328,25 @@ value="{{ object.mic.name|default_if_none:"" }}"/>
+ + {% if object.dry_hire %} +
+ + +
+ + + +
+
+ {% endif %} diff --git a/RIGS/views.py b/RIGS/views.py index 308d142c..f3e7c9d3 100644 --- a/RIGS/views.py +++ b/RIGS/views.py @@ -193,6 +193,7 @@ class SecureAPIRequest(generic.View): 'person': models.Person, 'organisation': models.Organisation, 'mic': models.Profile, + 'profile': models.Profile, } ''' diff --git a/db.sqlite3 b/db.sqlite3 index 5300e8cb..99181621 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ