working on speaker and event list
This commit is contained in:
parent
562356cf6b
commit
4da3b61a89
|
@ -44,7 +44,7 @@
|
|||
<li><a href="{% url 'shop:index' %}">Shop</a></li>
|
||||
{% endif %}
|
||||
<li><a href="{% url 'villages:list' %}">Villages</a></li>
|
||||
<li><a href="{% url 'call-for-speakers' %}">Speakers</a></li>
|
||||
<li><a href="{% url 'schedule:index' %}">Schedule</a></li>
|
||||
<li><a href="{% url 'call-for-sponsors' %}">Sponsors</a></li>
|
||||
<li><a href="{% url 'contact' %}">Contact</a></li>
|
||||
{% if user.is_authenticated %}
|
||||
|
|
|
@ -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)),
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
16
program/templates/event_list.html
Normal file
16
program/templates/event_list.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<p class="lead">
|
||||
An alphabetical list of all talks, workshops, keynotes and other events
|
||||
at BornHack 2016.
|
||||
</p>
|
||||
|
||||
<div class="list-group">
|
||||
{% for event in event_list %}
|
||||
<a href="{% url 'program:event' slug=event.slug %}" class="list-group-item">
|
||||
{{ event.title }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock content %}
|
|
@ -1,6 +1,9 @@
|
|||
{% extends 'program_base.html' %}
|
||||
|
||||
{% block program_content %}
|
||||
<a href="{% url 'call-for-speakers' %}" class="btn">Call for Speakers</a>
|
||||
<a href="{% url 'program:speakers_index' %}" class="btn">Speakers</a>
|
||||
<a href="{% url 'program:events_index' %}" class="btn">Talks & Events</a>
|
||||
|
||||
<a href="{% url 'program:index' %}" style="background-color: black; border: 0; color: white; display: inline-block; padding: 5px;">
|
||||
All
|
||||
|
|
16
program/templates/speaker_list.html
Normal file
16
program/templates/speaker_list.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<p class="lead">
|
||||
An alphabetical list of all speakers, workshop hosts and other
|
||||
event anchors at BornHack 2016.
|
||||
</p>
|
||||
|
||||
<div class="list-group">
|
||||
{% for speaker in speaker_list %}
|
||||
<a href="{% url 'program:speaker_detail' slug=speaker.slug %}" class="list-group-item">
|
||||
{{ speaker.name }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock content %}
|
|
@ -2,7 +2,10 @@ from django.conf.urls import url
|
|||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^(?P<slug>[-_\w+]+)/$', views.EventDetailView.as_view(), name='event'),
|
||||
url(r'^(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})$', views.ProgramDayView.as_view(), name='day'),
|
||||
url(r'^(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\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<slug>[-_\w+]+)/$', views.SpeakerDetail.as_view(), name='speaker_detail'),
|
||||
url(r'^events/$', views.EventListView.as_view(), name='events_index'),
|
||||
url(r'^(?P<slug>[-_\w+]+)/$', views.EventDetailView.as_view(), name='event'),
|
||||
]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue