room details
This commit is contained in:
parent
cd930cb9de
commit
f9e36b396f
|
@ -22,3 +22,11 @@ class Room(models.Model):
|
|||
|
||||
def get_absolute_url(self):
|
||||
return reverse('list-rooms')
|
||||
|
||||
@property
|
||||
def talks_by_date(self):
|
||||
return self.talk_set.filter(start_date__isnull=False).order_by('start_date').all()
|
||||
|
||||
@property
|
||||
def unscheduled_talks(self):
|
||||
return self.talk_set.filter(start_date__isnull=True).all()
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
{% extends 'base.html' %}
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
{% block planningtab %} class="active"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{{ room.name }}</h1>
|
||||
|
||||
{{ room.label }}
|
||||
|
||||
<h4>Scheduled talks:</h4>
|
||||
{% for talk in room.talks_by_date %}
|
||||
{% if forloop.first %}<ul>{% endif %}
|
||||
<li>{{ talk.start_date }} ({{ talk.estimated_duration }} mins): <a href="{% url 'show-talk' talk.slug %}">{{ talk }}</a></li>
|
||||
{% if forloop.last %}</ul>{% endif %}
|
||||
{% empty %}
|
||||
<em>{% trans "No talks." %}</em>
|
||||
{% endfor %}
|
||||
|
||||
<h4>Unscheduled talks:</h4>
|
||||
{% for talk in room.unscheduled_talks %}
|
||||
{% if forloop.first %}<ul>{% endif %}
|
||||
<li><a href="{% url 'show-talk' talk.slug %}">{{ talk }}</a></li>
|
||||
{% if forloop.last %}</ul>{% endif %}
|
||||
{% empty %}
|
||||
<em>{% trans "No talks." %}</em>
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
|
@ -15,16 +15,18 @@
|
|||
<div class="row">
|
||||
{% for room in room_list %}
|
||||
<div class="col-xs-6 col-sm-4">
|
||||
<h2>{{ room }}</h2>
|
||||
<h2><a href="{% url 'show-room' room.slug %}">{{ room }}</a></h2>
|
||||
{% if room.label %}<p>{{ room.label }}</p>{% endif %}
|
||||
<p>
|
||||
{{ room.capacity }} {% trans "place" %}{{ room.capacity|pluralize }}
|
||||
{% if request|staff %}
|
||||
|
|
||||
{{ room.talk_set.count }} {% trans "talk" %}{{ room.talk_set.count|pluralize }}
|
||||
{% if request|orga %}
|
||||
|
|
||||
<a href="{% url 'edit-room' room.slug %}">{% bootstrap_icon "pencil" %}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
{% cycle '' '<div class="clearfix visible-xs"></div>' %}
|
||||
|
|
|
@ -6,5 +6,6 @@ from planning import views
|
|||
urlpatterns = [
|
||||
url(r'^room/$', views.RoomList.as_view(), name='list-rooms'),
|
||||
url(r'^room/add/$', views.RoomCreate.as_view(), name='add-room'),
|
||||
url(r'^room/(?P<slug>[-\w]+)/$', views.RoomDetail.as_view(), name='show-room'),
|
||||
url(r'^room/(?P<slug>[-\w]+)/edit/$', views.RoomUpdate.as_view(), name='edit-room'),
|
||||
]
|
||||
|
|
|
@ -2,7 +2,7 @@ from django.shortcuts import render
|
|||
from django.contrib.sites.shortcuts import get_current_site
|
||||
from django.views.generic import CreateView, DetailView, ListView, UpdateView
|
||||
|
||||
from accounts.mixins import OrgaRequiredMixin
|
||||
from accounts.mixins import OrgaRequiredMixin, StaffRequiredMixin
|
||||
from proposals.mixins import OnSiteFormMixin
|
||||
|
||||
from .models import Room
|
||||
|
@ -18,7 +18,7 @@ class RoomFormMixin(OnSiteFormMixin):
|
|||
form_class = RoomForm
|
||||
|
||||
|
||||
class RoomList(OrgaRequiredMixin, RoomMixin, ListView):
|
||||
class RoomList(StaffRequiredMixin, RoomMixin, ListView):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -27,3 +27,6 @@ class RoomCreate(OrgaRequiredMixin, RoomMixin, RoomFormMixin, CreateView):
|
|||
|
||||
class RoomUpdate(OrgaRequiredMixin, RoomMixin, RoomFormMixin, UpdateView):
|
||||
pass
|
||||
|
||||
class RoomDetail(StaffRequiredMixin, RoomMixin, DetailView):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue