Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions events/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('<hr>'),
)
super(CCIForm, self).__init__(*args, **kwargs)
Expand All @@ -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()
Expand All @@ -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

Expand Down
22 changes: 22 additions & 0 deletions events/migrations/0015_cc_position.py
Original file line number Diff line number Diff line change
@@ -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),
),
]
24 changes: 24 additions & 0 deletions events/migrations/0016_cc_position.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
12 changes: 9 additions & 3 deletions events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 """
Expand Down
2 changes: 2 additions & 0 deletions events/views/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = {}
Expand Down
6 changes: 4 additions & 2 deletions site_tmpl/emails/email_ccadd.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@
<p align="left" class="article-title">{{ subject }}</p>
<div align="left" class="article-content">
<p>You've been added as a crew chief to the event {{ ccinstance.event.event_name }}.<br>
You have signed up to be crew chief for {{ ccinstance.category }},
with your setup starting on {{ ccinstance.setup_start }} in the {{ ccinstance.setup_location }}.</p>
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 %}.</p>

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

<p><b>{{ ccinstance.event.event_name }}</b><br>
<i>{{ ccinstance.event.location }}</i><br>
Start: {{ ccinstance.event.datetime_start }}<br>
End: {{ ccinstance.event.datetime_end }}<br>
{% if ccinstance.setup_start %}
Setup start: {{ ccinstance.setup_start }}<br>
{% endif %}
Setup complete: {{ ccinstance.event.datetime_setup_complete }}</p>

<p>See full details of this event <a href="{% get_base_url %}{% url 'events:detail' ccinstance.event.id %}">here</a>.</p>
Expand Down
2 changes: 1 addition & 1 deletion site_tmpl/emails/email_ccadd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 4 additions & 0 deletions site_tmpl/events_public.html
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,16 @@ <h2>Ongoing and Future Events</h2>
<td>{{event.location}} ({{event.location.building }})</td>
<td>
{% for cc in event.ccinstances.all|dictsort:"setup_start" %}
{% if cc.setup_location %}
<strong>{{cc.service.shortname }}</strong> {{cc.setup_location }} <br />
{% endif %}
{% endfor %}
</td>
<td>
{% for cc in event.ccinstances.all|dictsort:"setup_start" %}
{% if cc.setup_start %}
{{cc.setup_start }} <br />
{% endif %}
{% endfor %}
</td>
<td>
Expand Down
28 changes: 16 additions & 12 deletions site_tmpl/formset_crispy_helpers.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,42 @@ <h2>Crew Chiefs for "{{ event }}"</h2>
{{ formset.management_form }}
<table class="table table-striped" valign="top"> <tbody id="form_data">
<tr>
<th>Setup Location </th>
<th>Setup Time </th>
<th>Crew Chief</th>
{# <th>Setup Location </th> #}
{# <th>Setup Time </th> #}
{% if oldevent %}
<th>Service</th>
{% else %}
<th>Category</th>
{% endif %}
<th>Crew Chief</th>
<th>Position</th>
<th>Delete?</th>
</tr>
{% for form in formset %}
{% if form.errors %}
<tr class="warning">
<td>{% for e in form.setup_location.errors %} {{ e }} <i class="glyphicon glyphicon-chevron-down"></i> {% endfor %}</td>
<td>{% for e in form.setup_start.errors %} {{ e }} <i class="glyphicon glyphicon-chevron-down"></i> {% endfor %}</td>
<td></td>{% for e in form.crew_chief.errors %} {{ e }} <i class="glyphicon glyphicon-chevron-down"></i> {% endfor %}</td>
{# <td>{% for e in form.setup_location.errors %} {{ e }} <i class="glyphicon glyphicon-chevron-down"></i> {% endfor %}</td> #}
{# <td>{% for e in form.setup_start.errors %} {{ e }} <i class="glyphicon glyphicon-chevron-down"></i> {% endfor %}</td> #}
{% if oldevent %}
<td>{% for e in form.service.errors %} {{ e }} <i class="glyphicon glyphicon-chevron-down"></i> {% endfor %}</td>
{% else %}
<td>{% for e in form.category.errors %} {{ e }} <i class="glyphicon glyphicon-chevron-down"></i> {% endfor %}</td>
{% endif %}
<td>{% for e in form.crew_chief.errors %} {{ e }} <i class="glyphicon glyphicon-chevron-down"></i> {% endfor %}</td>
<td></td>{% for e in form.position.errors %} {{ e }} <i class="glyphicon glyphicon-chevron-down"></i> {% endfor %}</td>
<td>{% for e in form.DELETE.errors %} {{ e }} <i class="glyphicon glyphicon-chevron-down"></i> {% endfor %}</td>
</tr>
{% endif %}
<tr>
<td>{{ form.id }}{{ form.setup_location }} </td>
<td class="dtptable">{{ form.setup_start }} </td>
<td>{{ form.id }}{{ form.crew_chief }} </td>
{# <td>{{ form.id }}{{ form.setup_location }} </td> #}
{# <td class="dtptable">{{ form.setup_start }} </td> #}
{% if oldevent %}
<td>{{ form.service }}</td>
{% else %}
<td>{{ form.category }}</td>
{% endif %}
<td>{{ form.crew_chief }} </td>
<td>{{ form.position }} </td>
<td>{{ form.DELETE }} </td>
</tr>
{% endfor %}
Expand All @@ -59,14 +62,15 @@ <h2>Crew Chiefs for "{{ event }}"</h2>
{% with formset.empty_form as form %}
<table style="display:none;"> <tbody id="empty_form">
<tr>
<td>{{ form.id }}{{ form.setup_location }} </td>
<td class="dtptable">{{ form.setup_start }} </td>
<td>{{ form.id }}{{ form.crew_chief }} </td>
{# <td>{{ form.id }}{{ form.setup_location }} </td> #}
{# <td class="dtptable">{{ form.setup_start }} </td> #}
{% if oldevent %}
<td>{{ form.service }}</td>
{% else %}
<td>{{ form.category }}</td>
{% endif %}
<td>{{ form.crew_chief }} </td>
<td>{{ form.position }} </td>
<td>{{ form.DELETE }} </td>
</tr>
</tbody> </table>
Expand Down
2 changes: 2 additions & 0 deletions site_tmpl/price_breakdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
<td class="tdra">${{ service_instance.cost }}</td>
</tr>
{% endfor %}
{% endif %}
{% if event.extrainstance_set.exists %}
{% for extra_instance in event.extrainstance_set.all %}
<tr>
<td>{{ extra_instance }} <strong>x{{ extra_instance.quant }}</strong></td>
Expand Down
48 changes: 26 additions & 22 deletions site_tmpl/uglydetail.html
Original file line number Diff line number Diff line change
Expand Up @@ -556,23 +556,31 @@ <h2> Crew Chief(s) </h2>
<table class="table">
<tr>
<th>Name</th>
<th>Setup Location</th>
<th>Setup Time</th>
{% if has_cc_setup_times_or_locations %}
<th>Setup Location</th>
<th>Setup Time</th>
{% endif %}
<th>Category</th>
<th>Position</th>
</tr>
{% for cc in event.ccinstances.all %}
<tr>
<td>
<a href="{% url "accounts:detail" cc.crew_chief.id %}">{{ cc.crew_chief.get_full_name }}</a>
</td>
{% if has_cc_setup_times_or_locations %}
<td>
{{ cc.setup_location }}
</td>
<td>
{{ cc.setup_start }}
</td>
{% endif %}
<td>
{{ cc.setup_location }}
</td>
<td>
{{ cc.setup_start }}
{{ cc.category }}
</td>
<td>
{{ cc.category }}
{{ cc.position }}
</td>
{% endfor %}
</table>
Expand All @@ -593,13 +601,11 @@ <h2> Crew </h2>
</div>
{% permission request.user has 'events.view_event_reports' of event %}
<div id="reports" class="tab-pane">
{% if not event.closed %}
{% permission request.user has 'events.add_event_report' of event %}
<div class="pull-right">
<a class="btn btn-primary btn-lg" href="{% url "events:reports:new" event.id%}">New</a>
</div>
{% endpermission %}
{% endif %}
{% permission request.user has 'events.add_event_report' of event %}
<div class="pull-right">
<a class="btn btn-primary btn-lg" href="{% url "events:reports:new" event.id%}">New</a>
</div>
{% endpermission %}
<h2>Reports</h2>
{% for report in event.ccreport_set.all %}
<h4>Report by {{report.crew_chief }}</h4>
Expand All @@ -608,14 +614,12 @@ <h4>Report by {{report.crew_chief }}</h4>
{% 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 %}
[<a href="{% url "events:reports:edit" event.id report.id %}">Edit</a>]
{% endpermission %}
{% permission request.user has 'events.delete_ccreport' of report %}
[<a href="{% url "events:reports:remove" event.id report.id %}">Delete</a>]
{% endpermission %}
{% endif %}
{% permission request.user has 'events.change_ccreport' of report %}
[<a href="{% url "events:reports:edit" event.id report.id %}">Edit</a>]
{% endpermission %}
{% permission request.user has 'events.delete_ccreport' of report %}
[<a href="{% url "events:reports:remove" event.id report.id %}">Delete</a>]
{% endpermission %}
</em>

<blockquote>
Expand Down
4 changes: 2 additions & 2 deletions slack/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
}
},
{
Expand Down
Loading