talk types
This commit is contained in:
parent
b92f79c010
commit
d30ce1e3a5
|
@ -1,6 +1,6 @@
|
||||||
- [x] enregistrement sur le site (pas d'enregistrement fb/linkedin: on aime le libre ici)
|
- [x] enregistrement sur le site (pas d'enregistrement fb/linkedin: on aime le libre ici)
|
||||||
- [ ] permettre de proposer une participation (conférence/atelier/small talk/etc.). Un speaker rentre un abstract et
|
- [x] permettre de proposer une participation (conférence/atelier/small talk/etc.).
|
||||||
peur associer un ou des co-speakers.
|
- [ ] Un speaker rentre un abstract et peut associer un ou des co-speakers.
|
||||||
- [ ] l'équipe organisatrice peut voter pour les conférences (avec un commentaire visible uniquement de l'équipe) et
|
- [ ] l'équipe organisatrice peut voter pour les conférences (avec un commentaire visible uniquement de l'équipe) et
|
||||||
les accepter/refuser
|
les accepter/refuser
|
||||||
- [ ] pour chaque conférence/conférencier, on permet d'échanger avec le conférencier (lui vois ça comme un mail, mais
|
- [ ] pour chaque conférence/conférencier, on permet d'échanger avec le conférencier (lui vois ça comme un mail, mais
|
||||||
|
|
|
@ -5,4 +5,4 @@ from proposals.models import Talk
|
||||||
__all__ = ['TalkForm']
|
__all__ = ['TalkForm']
|
||||||
|
|
||||||
|
|
||||||
TalkForm = modelform_factory(Talk, fields=['title', 'description', 'topics'])
|
TalkForm = modelform_factory(Talk, fields=['title', 'description', 'topics', 'event'])
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.7 on 2016-06-12 20:26
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('proposals', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='talk',
|
||||||
|
name='event',
|
||||||
|
field=models.IntegerField(choices=[(1, 'conference'), (2, 'workshop'), (3, 'stand'), (4, 'other')], default=1),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,3 +1,5 @@
|
||||||
|
from enum import IntEnum
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.sites.managers import CurrentSiteManager
|
from django.contrib.sites.managers import CurrentSiteManager
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
|
@ -6,6 +8,8 @@ from django.db import models
|
||||||
|
|
||||||
from autoslug import AutoSlugField
|
from autoslug import AutoSlugField
|
||||||
|
|
||||||
|
from accounts.models import enum_to_choices
|
||||||
|
|
||||||
__all__ = ['Topic', 'Talk', 'Speach']
|
__all__ = ['Topic', 'Talk', 'Speach']
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +27,8 @@ class Topic(models.Model):
|
||||||
|
|
||||||
class Talk(models.Model):
|
class Talk(models.Model):
|
||||||
|
|
||||||
|
EVENTS = IntEnum('Event', 'conference workshop stand other')
|
||||||
|
|
||||||
site = models.ForeignKey(Site, on_delete=models.CASCADE)
|
site = models.ForeignKey(Site, on_delete=models.CASCADE)
|
||||||
|
|
||||||
speakers = models.ManyToManyField(User, through='Speach')
|
speakers = models.ManyToManyField(User, through='Speach')
|
||||||
|
@ -30,6 +36,7 @@ class Talk(models.Model):
|
||||||
slug = AutoSlugField(populate_from='title', unique=True)
|
slug = AutoSlugField(populate_from='title', unique=True)
|
||||||
description = models.TextField(blank=True, verbose_name='Description')
|
description = models.TextField(blank=True, verbose_name='Description')
|
||||||
topics = models.ManyToManyField(Topic, blank=True)
|
topics = models.ManyToManyField(Topic, blank=True)
|
||||||
|
event = models.IntegerField(choices=enum_to_choices(EVENTS), default=EVENTS.conference.value)
|
||||||
|
|
||||||
objects = models.Manager()
|
objects = models.Manager()
|
||||||
on_site = CurrentSiteManager()
|
on_site = CurrentSiteManager()
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<ul>
|
||||||
|
{% regroup talk_list by event as event_list %}
|
||||||
|
{% for event in event_list %}
|
||||||
|
<li>{{ event.list.0.get_event_display }}
|
||||||
|
<ul>{% for talk in event.list %}
|
||||||
|
<li>
|
||||||
|
<a href="{% url 'show-talk' talk.slug %}">{{ talk }}</a>
|
||||||
|
<i>by</i>
|
||||||
|
{% for speaker in talk.speakers.all %}
|
||||||
|
<a href="{% url 'show-speaker' speaker.username %}">{{ speaker }}</a>
|
||||||
|
{% if forloop.revcounter == 2 %} and {% elif not forloop.last %}, {% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% empty %}Nothing
|
||||||
|
</li>{% endfor %}
|
||||||
|
</ul>
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
<a class="btn btn-primary" href="{% url 'edit-talk' talk.slug %}">edit</a><br />
|
<a class="btn btn-primary" href="{% url 'edit-talk' talk.slug %}">edit</a><br />
|
||||||
|
|
||||||
|
<p>{{ talk.get_event_display }}</p>
|
||||||
|
|
||||||
<b>Description:</b>
|
<b>Description:</b>
|
||||||
|
|
||||||
<p>{{ talk.description }}</p>
|
<p>{{ talk.description }}</p>
|
||||||
|
|
|
@ -6,19 +6,6 @@
|
||||||
|
|
||||||
<h1>{{ title }}</h1>
|
<h1>{{ title }}</h1>
|
||||||
|
|
||||||
<ul>
|
{% include "proposals/_talk_list.html" %}
|
||||||
{% for talk in talk_list %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'show-talk' talk.slug %}">{{ talk }}</a>
|
|
||||||
<i>by</i>
|
|
||||||
{% for speaker in talk.speakers.all %}
|
|
||||||
<a href="{% url 'show-speaker' speaker.username %}">{{ speaker }}</a>
|
|
||||||
{% if forloop.revcounter == 2 %} and {% elif not forloop.last %}, {% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</li>
|
|
||||||
{% empty %}
|
|
||||||
<li><i>No talk.</i></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -8,37 +8,10 @@
|
||||||
|
|
||||||
<div class="h3">My participing talks:</div>
|
<div class="h3">My participing talks:</div>
|
||||||
|
|
||||||
<ul>
|
{% include "proposals/_talk_list.html" with talk_list=my_talks%}
|
||||||
{% for talk in my_talks %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'show-talk' talk.slug %}">{{ talk }}</a>
|
|
||||||
<i>by</i>
|
|
||||||
{% for speaker in talk.speakers.all %}
|
|
||||||
<a href="{% url 'show-speaker' speaker.username %}">{{ speaker }}</a>
|
|
||||||
{% if forloop.revcounter == 2 %} and {% elif not forloop.last %}, {% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
<a class="btn btn-primary btn-xs" href="{% url 'edit-talk' talk.slug %}">edit</a>
|
|
||||||
</li>
|
|
||||||
{% empty %}
|
|
||||||
<li>No proposed talk.</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="h3">Others talks:</div>
|
<div class="h3">Others talks:</div>
|
||||||
|
|
||||||
<ul>
|
{% include "proposals/_talk_list.html" with talk_list=other_talks%}
|
||||||
{% for talk in other_talks %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url 'show-talk' talk.slug %}">{{ talk }}</a>
|
|
||||||
<i>by</i>
|
|
||||||
{% for speach in talk.speach_set.all %}
|
|
||||||
<a href="{% url 'show-speaker' speach.username %}">{{ speach.user }}</a>
|
|
||||||
{% if forloop.revcounter == 2 %} and {% elif not forloop.last %}, {% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</li>
|
|
||||||
{% empty %}
|
|
||||||
<li>No other talk.</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -14,10 +14,10 @@ class ProposalsTests(TestCase):
|
||||||
def test_everything(self):
|
def test_everything(self):
|
||||||
# talk-edit
|
# talk-edit
|
||||||
self.client.login(username='a', password='a')
|
self.client.login(username='a', password='a')
|
||||||
self.client.post(reverse('add-talk'), {'title': 'super talk', 'description': 'super'})
|
self.client.post(reverse('add-talk'), {'title': 'super talk', 'description': 'super', 'event': 1})
|
||||||
self.assertEqual(str(Talk.on_site.first()), 'super talk')
|
self.assertEqual(str(Talk.on_site.first()), 'super talk')
|
||||||
self.client.post(reverse('edit-talk', kwargs={'talk': 'super-talk'}),
|
self.client.post(reverse('edit-talk', kwargs={'talk': 'super-talk'}),
|
||||||
{'title': 'mega talk', 'description': 'mega'})
|
{'title': 'mega talk', 'description': 'mega', 'event': 1})
|
||||||
self.assertEqual(str(Talk.on_site.first()), 'mega talk')
|
self.assertEqual(str(Talk.on_site.first()), 'mega talk')
|
||||||
|
|
||||||
# Status Code
|
# Status Code
|
||||||
|
@ -32,7 +32,7 @@ class ProposalsTests(TestCase):
|
||||||
|
|
||||||
self.client.login(username='b', password='b')
|
self.client.login(username='b', password='b')
|
||||||
self.assertEqual(self.client.post(reverse('edit-talk', kwargs={'talk': 'super-talk'}),
|
self.assertEqual(self.client.post(reverse('edit-talk', kwargs={'talk': 'super-talk'}),
|
||||||
{'title': 'mega talk', 'description': 'mega'}).status_code, 403)
|
{'title': 'mega talk', 'description': 'mega', 'event': 1}).status_code, 403)
|
||||||
self.assertEqual(self.client.get(reverse('list-talks')).status_code, 200)
|
self.assertEqual(self.client.get(reverse('list-talks')).status_code, 200)
|
||||||
|
|
||||||
# Models str & get_asbolute_url
|
# Models str & get_asbolute_url
|
||||||
|
|
Loading…
Reference in New Issue