Skip to content

Commit

Permalink
Merge pull request #76 from Danyc0/links-to-event-pages
Browse files Browse the repository at this point in the history
Add links from tasks/talks to the FOSDEM website page for the talk
  • Loading branch information
Danyc0 authored Feb 8, 2024
2 parents a3ae1c9 + 5378fc6 commit d728ed0
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 3 deletions.
1 change: 1 addition & 0 deletions volunteers/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class EditTasksForm(forms.Form):
end_time = forms.TimeField(label=_('End time'), required=True)
name = forms.CharField(label=_('Name'), 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)


class EventSignupForm(forms.Form):
Expand Down
39 changes: 39 additions & 0 deletions volunteers/migrations/0008_auto_20240207_1717.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Generated by Django 3.2 on 2024-02-07 16:17

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


class Migration(migrations.Migration):

dependencies = [
('volunteers', '0007_auto_20240128_1606'),
]

operations = [
migrations.AddField(
model_name='talk',
name='fosdem_url',
field=models.TextField(null=True),
),
migrations.AddField(
model_name='task',
name='fosdem_url',
field=models.TextField(null=True),
),
migrations.AlterField(
model_name='task',
name='edition',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, to='volunteers.edition'),
),
migrations.AlterField(
model_name='track',
name='edition',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, to='volunteers.edition'),
),
migrations.AlterField(
model_name='volunteerstatus',
name='edition',
field=models.ForeignKey(default=1, 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 @@ -202,6 +202,7 @@ def __str__(self):
title = models.CharField(max_length=256)
speaker = models.CharField(max_length=128)
description = models.TextField()
fosdem_url = models.TextField(null=True)
date = models.DateField()
start_time = models.TimeField()
end_time = models.TimeField()
Expand Down Expand Up @@ -238,6 +239,7 @@ def penta_create_or_update(cls, xml, edition, day_date):
talk.track = track
talk.title = xml.find('title').text
talk.description = xml.find('description').text or ''
talk.fosdem_url = xml.find('url').text
talk.date = day_date
(talk.start_time, talk.end_time) = (talk_start, talk_end)
persons = xml.find('persons')
Expand Down Expand Up @@ -345,6 +347,7 @@ def __str__(self):
# infodesk tasks if we do a simple name search in create_from_xml
counter = models.CharField(max_length=2)
description = models.TextField()
fosdem_url = models.TextField(null=True)
date = models.DateField()
start_time = models.TimeField()
end_time = models.TimeField()
Expand Down Expand Up @@ -397,6 +400,7 @@ def create_or_update_from_talk(cls, edition, talk, task_type, volunteers):
task = cls(talk=talk, template=template)
task.template = template
task.name = '%s: %s' % (task_type, talk.title)
task.fosdem_url = talk.fosdem_url
task.date = talk.date
task.start_time = talk.start_time
task.end_time = talk.end_time
Expand All @@ -421,6 +425,7 @@ def create_from_xml(cls, xml, edition):
else:
task = cls(name=name, counter=counter, template=template, edition=edition)
task.description = xml.find('description').text
task.fosdem_url = xml.find('url').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: 6 additions & 1 deletion volunteers/templates/volunteers/talk_detailed.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
</tr>
<tr>
<td>{{ talk.date|date:"D" }}, {{ talk.start_time|time:"H:i" }} - {{ talk.end_time|time:"H:i" }}</td>
<td>{{ talk.title }}</td>
<td>
{% if talk.fosdem_url %}
<a href="{{talk.fosdem_url}}">{{ talk.title }}</a>
{% else %}
{{talk.title}}
{% endif %}</td>
<td>
{% for volunteer in talk.volunteers.all %}
{{ volunteer.user.first_name }} {{ volunteer.user.last_name }},
Expand Down
9 changes: 7 additions & 2 deletions volunteers/templates/volunteers/task_detailed.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@
{% endfor %}
{% else %}
{{ task.volunteer_set.count}}/{{ task.nbr_volunteers }}
{% endif%}
<td>{{ task.talk }}</td>
{% endif%}</td>
<td>
{% if task.fosdem_url %}
<a href="{{task.fosdem_url}}">{{ task.talk }}</a>
{% else %}
{{task.talk}}
{% endif %}</td>
</tr>
<tr>
<th colspan="4" style="border-bottom: none;">&nbsp;</th>
Expand Down

0 comments on commit d728ed0

Please sign in to comment.