diff --git a/events/forms.py b/events/forms.py index f3efd080..f992f42e 100644 --- a/events/forms.py +++ b/events/forms.py @@ -1348,8 +1348,9 @@ def __init__(self, event, *args, **kwargs): self.helper.layout = Layout( Field('crew_chief', placeholder="Crew Chief", title=""), Field('service' if isinstance(event, Event) else 'category'), - Field('setup_location'), - Field('setup_start', css_class="dtp"), + #Field('setup_location'), + #Field('setup_start', css_class="dtp"), + Field('position'), HTML('
'), ) super(CCIForm, self).__init__(*args, **kwargs) @@ -1359,9 +1360,9 @@ def __init__(self, event, *args, **kwargs): if isinstance(event, Event2019): self.fields['category'].queryset = Category.objects.filter( pk__in=event.serviceinstance_set.values_list('service__category', flat=True)) - self.fields['setup_start'].initial = self.fields['setup_start'].prepare_value( - self.event.datetime_setup_complete.replace(second=0, microsecond=0) - ) + #self.fields['setup_start'].initial = self.fields['setup_start'].prepare_value( + # self.event.datetime_setup_complete.replace(second=0, microsecond=0) + #) def clean(self): cleaned_data = super(CCIForm, self).clean() @@ -1386,15 +1387,16 @@ def save(self, commit=True): class Meta: model = EventCCInstance - fields = ('category', 'crew_chief', 'service', 'setup_location', 'setup_start') + #fields = ('category', 'crew_chief', 'service', 'setup_location', 'setup_start') + fields = ('category', 'crew_chief', 'service', 'position') crew_chief = AutoCompleteSelectField('Members', required=True) - setup_start = forms.SplitDateTimeField(initial=timezone.now) - setup_location = GroupedModelChoiceField( - queryset=Location.objects.filter(setup_only=True).select_related('building'), - group_by_field="building", - group_label=lambda group: group.name, - ) + #setup_start = forms.SplitDateTimeField(initial=timezone.now) + #setup_location = GroupedModelChoiceField( + # queryset=Location.objects.filter(setup_only=True).select_related('building'), + # group_by_field="building", + # group_label=lambda group: group.name, + #) category = ModelChoiceField(queryset=Category.objects.all(), required=False) service = ModelChoiceField(queryset=Service.objects.all(), required=False) # queryset gets changed in constructor diff --git a/events/migrations/0015_cc_position.py b/events/migrations/0015_cc_position.py new file mode 100644 index 00000000..3c2b7e8e --- /dev/null +++ b/events/migrations/0015_cc_position.py @@ -0,0 +1,22 @@ +# Generated by Django 4.2.13 on 2025-10-27 04:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('events', '0014_event_updates'), + ] + + operations = [ + migrations.AlterModelOptions( + name='hours', + options={'ordering': ('event',)}, + ), + migrations.AddField( + model_name='eventccinstance', + name='position', + field=models.CharField(max_length=128, null=True), + ), + ] diff --git a/events/migrations/0016_cc_position.py b/events/migrations/0016_cc_position.py new file mode 100644 index 00000000..f745aee8 --- /dev/null +++ b/events/migrations/0016_cc_position.py @@ -0,0 +1,24 @@ +# Generated by Django 4.2.13 on 2025-10-27 05:16 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('events', '0015_cc_position'), + ] + + operations = [ + migrations.AlterField( + model_name='eventccinstance', + name='position', + field=models.CharField(blank=True, default='', max_length=128), + ), + migrations.AlterField( + model_name='eventccinstance', + name='setup_location', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='ccinstances', to='events.location'), + ), + ] diff --git a/events/models.py b/events/models.py index 2283bc3f..85168768 100755 --- a/events/models.py +++ b/events/models.py @@ -1496,9 +1496,11 @@ class EventCCInstance(models.Model): category = models.ForeignKey(Category, on_delete=models.PROTECT, related_name='ccinstances') service = models.ForeignKey(Service, on_delete=models.PROTECT, null=True, related_name='ccinstances') - setup_location = models.ForeignKey(Location, on_delete=models.PROTECT, related_name='ccinstances') + setup_location = models.ForeignKey(Location, on_delete=models.PROTECT, null=True, related_name='ccinstances') setup_start = models.DateTimeField(null=True, blank=True) + position = models.CharField(max_length=128, default="", blank=True) + def cal_name(self): """ Title used by calendars """ return self.event.event_name + ' ' + (self.service.shortname if self.service else self.category.name) + ' Setup' @@ -1518,11 +1520,15 @@ def cal_desc(self): def cal_location(self): """ Location used by calendars """ - return self.setup_location.name + if self.setup_location: + return self.setup_location.name + return "" def cal_start(self): """ Start time used by calendars (setup) """ - return self.setup_start + if self.setup_start: + return self.setup_start + return "" def cal_end(self): """ End time used by calendars """ diff --git a/events/views/flow.py b/events/views/flow.py index 489c6916..e82eecd8 100644 --- a/events/views/flow.py +++ b/events/views/flow.py @@ -1002,6 +1002,8 @@ def viewevent(request, id): context['history'] = Version.objects.get_for_object(event) if isinstance(event, Event2019): context['crew_count'] = event.crew_attendance.filter(active=True).values('user').count() + + context["has_cc_setup_times_or_locations"] = event.ccinstances.filter(setup_location__isnull=False).exists() or event.ccinstances.filter(setup_start__isnull=False).exists() if event.serviceinstance_set.exists(): context['categorized_services_and_extras'] = {} diff --git a/site_tmpl/emails/email_ccadd.html b/site_tmpl/emails/email_ccadd.html index 11699cd7..c11216aa 100644 --- a/site_tmpl/emails/email_ccadd.html +++ b/site_tmpl/emails/email_ccadd.html @@ -15,8 +15,8 @@

{{ subject }}

You've been added as a crew chief to the event {{ ccinstance.event.event_name }}.
- You have signed up to be crew chief for {{ ccinstance.category }}, - with your setup starting on {{ ccinstance.setup_start }} in the {{ ccinstance.setup_location }}.

+ You have signed up to be crew chief for {{ ccinstance.category }}{% if ccinstance.setup_start and ccinstance.setup_location %}, + with your setup starting on {{ ccinstance.setup_start }} in the {{ ccinstance.setup_location }}{% endif %}.

Please note that the attached Workorder PDF contains all services relating to the event, not just your assigned service.

@@ -24,7 +24,9 @@ {{ ccinstance.event.location }}
Start: {{ ccinstance.event.datetime_start }}
End: {{ ccinstance.event.datetime_end }}
+ {% if ccinstance.setup_start %} Setup start: {{ ccinstance.setup_start }}
+ {% endif %} Setup complete: {{ ccinstance.event.datetime_setup_complete }}

See full details of this event here.

diff --git a/site_tmpl/emails/email_ccadd.txt b/site_tmpl/emails/email_ccadd.txt index 79d68c2c..9c4d1d14 100644 --- a/site_tmpl/emails/email_ccadd.txt +++ b/site_tmpl/emails/email_ccadd.txt @@ -3,7 +3,7 @@ {{ subject }} You've been added as a crew chief to the event {{ ccinstance.event.event_name }}. -You have signed up to be crew chief for {{ ccinstance.category }}, with your setup starting on {{ ccinstance.setup_start }} in the {{ ccinstance.setup_location }}. +You have signed up to be crew chief for {{ ccinstance.category }}{% if ccinstance.setup_start %}, with your setup starting on {{ ccinstance.setup_start }} in the {{ ccinstance.setup_location }}{% endif %}. Please note that the attached Workorder PDF contains all services relating to the event, not just your assigned service. diff --git a/site_tmpl/events_public.html b/site_tmpl/events_public.html index 9c0c72a3..96685cd5 100644 --- a/site_tmpl/events_public.html +++ b/site_tmpl/events_public.html @@ -155,12 +155,16 @@

Ongoing and Future Events

{{event.location}} ({{event.location.building }}) {% for cc in event.ccinstances.all|dictsort:"setup_start" %} + {% if cc.setup_location %} {{cc.service.shortname }} {{cc.setup_location }}
+ {% endif %} {% endfor %} {% for cc in event.ccinstances.all|dictsort:"setup_start" %} + {% if cc.setup_start %} {{cc.setup_start }}
+ {% endif %} {% endfor %} diff --git a/site_tmpl/formset_crispy_helpers.html b/site_tmpl/formset_crispy_helpers.html index 8cff3687..ec9b0a69 100644 --- a/site_tmpl/formset_crispy_helpers.html +++ b/site_tmpl/formset_crispy_helpers.html @@ -11,39 +11,42 @@

Crew Chiefs for "{{ event }}"

{{ formset.management_form }} - - + + {# #} + {# #} {% if oldevent %} {% else %} {% endif %} - + {% for form in formset %} {% if form.errors %} - - + {% for e in form.crew_chief.errors %} {{ e }} {% endfor %} + {# #} + {# #} {% if oldevent %} {% else %} {% endif %} - + {% for e in form.position.errors %} {{ e }} {% endfor %} {% endif %} - - + + {# #} + {# #} {% if oldevent %} {% else %} {% endif %} - + {% endfor %} @@ -59,14 +62,15 @@

Crew Chiefs for "{{ event }}"

{% with formset.empty_form as form %}
Setup Location Setup Time Crew ChiefSetup Location Setup Time ServiceCategoryCrew ChiefPosition Delete?
{% for e in form.setup_location.errors %} {{ e }} {% endfor %}{% for e in form.setup_start.errors %} {{ e }} {% endfor %}{% for e in form.setup_location.errors %} {{ e }} {% endfor %}{% for e in form.setup_start.errors %} {{ e }} {% endfor %}{% for e in form.service.errors %} {{ e }} {% endfor %}{% for e in form.category.errors %} {{ e }} {% endfor %}{% for e in form.crew_chief.errors %} {{ e }} {% endfor %} {% for e in form.DELETE.errors %} {{ e }} {% endfor %}
{{ form.id }}{{ form.setup_location }} {{ form.setup_start }} {{ form.id }}{{ form.crew_chief }} {{ form.id }}{{ form.setup_location }} {{ form.setup_start }} {{ form.service }}{{ form.category }}{{ form.crew_chief }} {{ form.position }} {{ form.DELETE }}
- - + + {# #} + {# #} {% if oldevent %} {% else %} {% endif %} - +
{{ form.id }}{{ form.setup_location }} {{ form.setup_start }} {{ form.id }}{{ form.crew_chief }} {{ form.id }}{{ form.setup_location }} {{ form.setup_start }} {{ form.service }}{{ form.category }}{{ form.crew_chief }} {{ form.position }} {{ form.DELETE }}
diff --git a/site_tmpl/price_breakdown.html b/site_tmpl/price_breakdown.html index c6d4bec8..1a0d856d 100644 --- a/site_tmpl/price_breakdown.html +++ b/site_tmpl/price_breakdown.html @@ -72,6 +72,8 @@ ${{ service_instance.cost }} {% endfor %} + {% endif %} + {% if event.extrainstance_set.exists %} {% for extra_instance in event.extrainstance_set.all %} {{ extra_instance }} x{{ extra_instance.quant }} diff --git a/site_tmpl/uglydetail.html b/site_tmpl/uglydetail.html index 51e3d59d..5509b0b0 100644 --- a/site_tmpl/uglydetail.html +++ b/site_tmpl/uglydetail.html @@ -556,23 +556,31 @@

Crew Chief(s)

- - + {% if has_cc_setup_times_or_locations %} + + + {% endif %} + {% for cc in event.ccinstances.all %} + {% if has_cc_setup_times_or_locations %} + + + {% endif %} - {% endfor %}
NameSetup LocationSetup TimeSetup LocationSetup TimeCategoryPosition
{{ cc.crew_chief.get_full_name }} + {{ cc.setup_location }} + + {{ cc.setup_start }} + - {{ cc.setup_location }} - - {{ cc.setup_start }} + {{ cc.category }} - {{ cc.category }} + {{ cc.position }}
@@ -593,13 +601,11 @@

Crew

{% permission request.user has 'events.view_event_reports' of event %}
- {% if not event.closed %} - {% permission request.user has 'events.add_event_report' of event %} -
- New -
- {% endpermission %} - {% endif %} + {% permission request.user has 'events.add_event_report' of event %} +
+ New +
+ {% endpermission %}

Reports

{% for report in event.ccreport_set.all %}

Report by {{report.crew_chief }}

@@ -608,14 +614,12 @@

Report by {{report.crew_chief }}

{% if report.created_on != report.updated_on %} Last Updated: {{ report.updated_on }} {% endif %} - {% if not event.closed %} - {% permission request.user has 'events.change_ccreport' of report %} - [Edit] - {% endpermission %} - {% permission request.user has 'events.delete_ccreport' of report %} - [Delete] - {% endpermission %} - {% endif %} + {% permission request.user has 'events.change_ccreport' of report %} + [Edit] + {% endpermission %} + {% permission request.user has 'events.delete_ccreport' of report %} + [Delete] + {% endpermission %}
diff --git a/slack/views.py b/slack/views.py index 163eb770..53097d50 100644 --- a/slack/views.py +++ b/slack/views.py @@ -677,9 +677,9 @@ def cc_add_notification(cci): "type": "section", "text": { "type": "mrkdwn", - "text": "You've been added as a crew chief to the event *%s*. Your setup is currently scheduled for " + "text": "You've been added as a crew chief to the event *%s*." + "Your setup is currently scheduled for " "*%s* in the *%s*." % (cci.event.event_name, cci.setup_start.strftime('%b %-d, %Y at %-I:%M %p'), - cci.setup_location.name.strip()) + cci.setup_location.name.strip()) if cci.setup_start and cci.setup_location else "" } }, {