Skip to content

Commit

Permalink
Merge pull request #86 from Danyc0/add-task-locations
Browse files Browse the repository at this point in the history
Add the location of each talk/task to various pages
  • Loading branch information
Danyc0 authored Feb 9, 2024
2 parents 740b5a5 + fd1ca9f commit 88e503a
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 5 deletions.
6 changes: 3 additions & 3 deletions volunteers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,15 @@ class VolunteerTaskAdmin(admin.ModelAdmin):
class TaskAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['edition', 'name', 'nbr_volunteers', 'nbr_volunteers_min', 'nbr_volunteers_max', 'date',
'start_time', 'end_time']}),
'start_time', 'end_time', 'location']}),
(None, {'fields': ['talk', 'template']}),
(None, {'fields': ['description', 'fosdem_url']}),
]
# inlines = (VolunteerTaskInline,)
list_display = ['link', 'edition', 'name', 'date', 'start_time', 'end_time', 'assigned_volunteers',
'nbr_volunteers', 'nbr_volunteers_min', 'nbr_volunteers_max']
'nbr_volunteers', 'nbr_volunteers_min', 'nbr_volunteers_max', 'location']
list_editable = ['name', 'date', 'start_time', 'end_time', 'nbr_volunteers', 'nbr_volunteers_min',
'nbr_volunteers_max']
'nbr_volunteers_max', 'location']
list_filter = [EditionFilter, DayListFilter, 'template', 'talk__track']

actions = ['mass_mail_volunteer']
Expand Down
1 change: 1 addition & 0 deletions volunteers/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class EditTasksForm(forms.Form):
start_time = forms.TimeField(label=_('Start time'), required=True)
end_time = forms.TimeField(label=_('End time'), required=True)
name = forms.CharField(label=_('Name'), max_length=30, required=True)
location = forms.CharField(label=_('Location'), max_length=30, required=True)
description = forms.CharField(label=_('Description'), max_length=30, required=False, widget=forms.Textarea)
fosdem_url = forms.CharField(label=_('Fosdem URL'), max_length=100, required=False, widget=forms.Textarea)

Expand Down
44 changes: 44 additions & 0 deletions volunteers/migrations/0009_auto_20240209_1048.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Generated by Django 3.2 on 2024-02-09 09:48

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('volunteers', '0008_auto_20240207_1717'),
]

operations = [
migrations.AddField(
model_name='talk',
name='location',
field=models.CharField(max_length=128, null=True),
),
migrations.AddField(
model_name='task',
name='location',
field=models.CharField(max_length=30, null=True),
),
migrations.AlterField(
model_name='task',
name='edition',
field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.PROTECT, to='volunteers.edition'),
),
migrations.AlterField(
model_name='task',
name='fosdem_url',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='track',
name='edition',
field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.PROTECT, to='volunteers.edition'),
),
migrations.AlterField(
model_name='volunteerstatus',
name='edition',
field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.PROTECT, to='volunteers.edition'),
),
]
5 changes: 5 additions & 0 deletions volunteers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def __str__(self):
speaker = models.CharField(max_length=128)
description = models.TextField()
fosdem_url = models.TextField(null=True)
location = models.CharField(max_length=128, null=True)
date = models.DateField()
start_time = models.TimeField()
end_time = models.TimeField()
Expand Down Expand Up @@ -240,6 +241,7 @@ def penta_create_or_update(cls, xml, edition, day_date):
talk.title = xml.find('title').text
talk.description = xml.find('description').text or ''
talk.fosdem_url = xml.find('url').text
talk.location = xml.find('room').text
talk.date = day_date
(talk.start_time, talk.end_time) = (talk_start, talk_end)
persons = xml.find('persons')
Expand Down Expand Up @@ -348,6 +350,7 @@ def __str__(self):
counter = models.CharField(max_length=2)
description = models.TextField()
fosdem_url = models.TextField(null=True, blank=True)
location = models.CharField(null=True, max_length=30)
date = models.DateField()
start_time = models.TimeField()
end_time = models.TimeField()
Expand Down Expand Up @@ -401,6 +404,7 @@ def create_or_update_from_talk(cls, edition, talk, task_type, volunteers):
task.template = template
task.name = '%s: %s' % (task_type, talk.title)
task.fosdem_url = talk.fosdem_url
task.location = talk.location
task.date = talk.date
task.start_time = talk.start_time
task.end_time = talk.end_time
Expand All @@ -426,6 +430,7 @@ def create_from_xml(cls, xml, edition):
task = cls(name=name, counter=counter, template=template, edition=edition)
task.description = xml.find('description').text
task.fosdem_url = xml.find('url').text
task.location = xml.find('location').text
day_offset = int(xml.find('day').text)
task.date = edition.start_date + datetime.timedelta(days=day_offset)
task.start_time = parse_time(xml.find('start_time').text)
Expand Down
7 changes: 7 additions & 0 deletions volunteers/templates/volunteers/talk_detailed.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<th width="20%">{% trans 'When' %}</th>
<th width="40%">{% trans 'Title' %}</th>
<th width="20%">{% trans 'Attending' %}</th>
{% if talk.location %}
<th width="20%">{% trans 'Location' %}</th>
{% endif %}
</tr>
<tr>
<td>{{ talk.date|date:"D" }}, {{ talk.start_time|time:"H:i" }} - {{ talk.end_time|time:"H:i" }}</td>
Expand All @@ -23,6 +26,10 @@
{{talk.title}}
{% endif %}</td>
<td>
{% if talk.location %}
<td>{{talk.location}}</td>
{% endif %}
<td>
{% for volunteer in talk.volunteers.all %}
{{ volunteer.user.first_name }} {{ volunteer.user.last_name }},
{% endfor %}
Expand Down
6 changes: 6 additions & 0 deletions volunteers/templates/volunteers/task_detailed.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<th width="40%">{% trans 'Title' %}</th>
<th width="20%">{% trans 'Attending' %}</th>
<th width="20%">{% trans 'Talk' %}</th>
{% if task.location %}
<th width="20%">{% trans 'Location' %}</th>
{% endif %}
</tr>
<tr>
<td>{{ task.date|date:"D" }}, {{ task.start_time|time:"H:i" }} - {{ task.end_time|time:"H:i" }}</td>
Expand All @@ -32,6 +35,9 @@
{% else %}
{{task.talk}}
{% endif %}</td>
{% if task.location %}
<td>{{task.location}}</td>
{% endif %}
</tr>
<tr>
<th colspan="4" style="border-bottom: none;">&nbsp;</th>
Expand Down
3 changes: 2 additions & 1 deletion volunteers/templates/volunteers/task_schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
{% for task, volunteers in tasks.items %}
<h2 class="task-title">
{{ task.name }} ({{task.assigned_volunteers}}/{{task.nbr_volunteers}})<br/>
{{ task.date|date:"l" }}, {{ task.start_time|time:"H:i" }} - {{ task.end_time|time:"H:i" }}
{{ task.date|date:"l" }}, {{ task.start_time|time:"H:i" }} - {{ task.end_time|time:"H:i" }}<br/>
{{ task.location }}
</h2><br/>
<table width="98%" class="task_schedule">
<tr><td colspan="4">&nbsp;</td></tr>
Expand Down
9 changes: 9 additions & 0 deletions volunteers/templates/volunteers/tasks.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<th width="55%">{% trans 'Task' %}</th>
<th width="20%">{% trans 'When' %}</th>
<th width="15%">{% trans 'Volunteers' %}</th>
<th width="15%">{% trans 'Location' %}</th>
</tr>
</thead>
<tbody>
Expand All @@ -40,6 +41,7 @@
<th class="no_vert_border">Problematic tasks #{{ forloop.counter }}:</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
</tr>
{% for task in task_set %}
<tr>
Expand All @@ -53,6 +55,7 @@
<td data-title="{% trans 'Volunteers' %}" class="task-volunteers {{ task.status_color }}" title="{% trans task.status %}
{% if user.is_authenticated %}<br/><br/>Signed up:<br/>{% for volunteer in task.volunteers.all %}* {{ volunteer.user.first_name }} {{ volunteer.user.last_name}} ({{ volunteer.user }})<br/>{% endfor %}{% endif %}">
{{ task.assigned_volunteers }}/{{ task.nbr_volunteers }}</td>
<td data-title="{% trans 'Location' %}">{{task.location}}</td>
</tr>
{% endfor %}
{% endfor %}
Expand Down Expand Up @@ -83,6 +86,7 @@
<th width="55%">{% trans 'Task' %}</th>
<th width="20%">{% trans 'When' %}</th>
<th width="15%">{% trans 'Volunteers' %}</th>
<th width="15%">{% trans 'Location' %}</th>
</tr>
</thead>
<tbody>
Expand All @@ -95,13 +99,15 @@
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
</tr>
{% endifchanged %}
<tr class="day">
<th class="no_vert_border">{{ day|date:"l" }}</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
</tr>
{% for category, category_tasks in categories.items %}
{% if category_tasks %}
Expand All @@ -112,13 +118,15 @@
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
</tr>
{% endifchanged %}
<tr class="category">
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">{{ category.name }}</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
<th class="no_vert_border">&nbsp;</th>
</tr>
{% for task in category_tasks %}
<tr>
Expand All @@ -136,6 +144,7 @@
<td data-title="{% trans 'Volunteers' %}" class="task-volunteers {{ task.status_color }}" title="{% trans task.status %}
{% if user.is_authenticated %}<br/><br/>Signed up:<br/>{% for volunteer in task.volunteers.all %}* {{ volunteer.user.first_name }} {{ volunteer.user.last_name}} ({{ volunteer.user }})<br/>{% endfor %}{% endif %}">
{{ task.assigned_volunteers }}/{{ task.nbr_volunteers }}</td>
<td data-title="{% trans 'Location' %}">{{task.location}}</td>
</tr>
{% endfor %}
{% endif %}
Expand Down
4 changes: 3 additions & 1 deletion volunteers/templates/volunteers/tasks_detailed.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
<table class="task_list">
<thead>
<tr>
<th width="20%">{% trans 'When' %}</th>
<th width="10%">{% trans 'When' %}</th>
<th width="40%">{% trans 'Title' %}</th>
<th width="20%">{% trans 'Attending' %}</th>
<th width="20%">{% trans 'Talk' %}</th>
<th width="10%">{% trans 'Location' %}</th>
</tr>
</thead>
<tbody>
Expand All @@ -42,6 +43,7 @@
{% if not forloop.last %},{% endif %}
{% endfor %}
<td data-title="{% trans 'Talk' %}">{{ task.talk }}</td>
<td data-title="{% trans 'Location' %}">{{ task.location }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down

0 comments on commit 88e503a

Please sign in to comment.