diff --git a/bornhack/templates/base.html b/bornhack/templates/base.html index cbc2ad57..675664fd 100644 --- a/bornhack/templates/base.html +++ b/bornhack/templates/base.html @@ -44,7 +44,7 @@
  • Shop
  • {% endif %}
  • Villages
  • -
  • Speakers
  • +
  • Schedule
  • Sponsors
  • Contact
  • {% if user.is_authenticated %} diff --git a/bornhack/urls.py b/bornhack/urls.py index 433c95eb..5715a0f0 100644 --- a/bornhack/urls.py +++ b/bornhack/urls.py @@ -79,8 +79,8 @@ urlpatterns = [ include('villages.urls', namespace='villages') ), url( - r'^program/', - include('program.urls', namespace='program') + r'^schedule/', + include('program.urls', namespace='schedule') ), url(r'^accounts/', include('allauth.urls')), url(r'^admin/', include(admin.site.urls)), diff --git a/program/models.py b/program/models.py index a1b5ba29..6b0a4620 100644 --- a/program/models.py +++ b/program/models.py @@ -23,9 +23,12 @@ class Event(CreatedUpdatedModel): slug = models.SlugField(blank=True, max_length=255) abstract = models.TextField() event_type = models.ForeignKey(EventType) - days = models.ManyToManyField('camps.Day') - start = models.TimeField() - end = models.TimeField() + days = models.ManyToManyField('camps.Day', null=True, blank=True) + start = models.TimeField(null=True, blank=True) + end = models.TimeField(null=True, blank=True) + + class Meta: + ordering = ['title'] def __str__(self): return self.title @@ -41,6 +44,7 @@ class Speaker(CreatedUpdatedModel): name = models.CharField(max_length=150) biography = models.TextField() picture = models.ImageField(null=True, blank=True) + slug = models.SlugField(blank=True, max_length=255) events = models.ManyToManyField( Event, related_name='speakers', @@ -48,5 +52,14 @@ class Speaker(CreatedUpdatedModel): blank=True, ) + class Meta: + ordering = ['name'] + def __str__(self): return self.name + + def save(self, **kwargs): + if not self.slug: + self.slug = slugify(self.name) + super(Event, self).save(**kwargs) + diff --git a/program/templates/event_list.html b/program/templates/event_list.html new file mode 100644 index 00000000..54d1a559 --- /dev/null +++ b/program/templates/event_list.html @@ -0,0 +1,16 @@ +{% extends 'base.html' %} + +{% block content %} +

    + An alphabetical list of all talks, workshops, keynotes and other events + at BornHack 2016. +

    + +
    + {% for event in event_list %} + + {{ event.title }} + + {% endfor %} +
    +{% endblock content %} diff --git a/program/templates/program_overview.html b/program/templates/program_overview.html index d48630c8..d936beee 100644 --- a/program/templates/program_overview.html +++ b/program/templates/program_overview.html @@ -1,6 +1,9 @@ {% extends 'program_base.html' %} {% block program_content %} +Call for Speakers +Speakers +Talks & Events All diff --git a/program/templates/speaker_list.html b/program/templates/speaker_list.html new file mode 100644 index 00000000..5726a8f4 --- /dev/null +++ b/program/templates/speaker_list.html @@ -0,0 +1,16 @@ +{% extends 'base.html' %} + +{% block content %} +

    + An alphabetical list of all speakers, workshop hosts and other + event anchors at BornHack 2016. +

    + +
    + {% for speaker in speaker_list %} + + {{ speaker.name }} + + {% endfor %} +
    +{% endblock content %} diff --git a/program/urls.py b/program/urls.py index 2871b5a2..da9e632d 100644 --- a/program/urls.py +++ b/program/urls.py @@ -2,7 +2,10 @@ from django.conf.urls import url from . import views urlpatterns = [ - url(r'^(?P[-_\w+]+)/$', views.EventDetailView.as_view(), name='event'), - url(r'^(?P\d{4})-(?P\d{2})-(?P\d{2})$', views.ProgramDayView.as_view(), name='day'), + url(r'^(?P\d{4})-(?P\d{2})-(?P\d{2})/$', views.ProgramDayView.as_view(), name='day'), url(r'^$', views.ProgramOverviewView.as_view(), name='index'), + url(r'^speakers/$', views.SpeakerListView.as_view(), name='speaker_index'), + url(r'speakers/(?P[-_\w+]+)/$', views.SpeakerDetail.as_view(), name='speaker_detail'), + url(r'^events/$', views.EventListView.as_view(), name='events_index'), + url(r'^(?P[-_\w+]+)/$', views.EventDetailView.as_view(), name='event'), ] diff --git a/program/views.py b/program/views.py index 3cdba13e..925ddb53 100644 --- a/program/views.py +++ b/program/views.py @@ -6,6 +6,13 @@ from django.views.generic import ListView, TemplateView, DetailView from camps.models import Day from . import models +class SpeakerListView(ListView): + model = models.Speaker + template_name = 'speaker_list.html' + +class EventListView(ListView): + model = models.Event + template_name = 'event_list.html' class ProgramOverviewView(ListView): model = models.Event