add orga boolean to participation
This commit is contained in:
parent
ecb2c70245
commit
8d44ec7f40
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.7 on 2016-06-25 14:37
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('accounts', '0006_auto_20160625_1137'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='participation',
|
||||
name='orga',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
|
@ -41,6 +41,7 @@ class Participation(PonyConfModel):
|
|||
connector = models.IntegerField(choices=enum_to_choices(CONNECTORS), blank=True, null=True)
|
||||
constraints = models.TextField(blank=True)
|
||||
sound = models.BooleanField("I need sound", default=False)
|
||||
orga = models.BooleanField(default=False)
|
||||
|
||||
objects = models.Manager()
|
||||
on_site = CurrentSiteManager()
|
||||
|
@ -56,7 +57,7 @@ class Participation(PonyConfModel):
|
|||
return reverse('show-participation', kwargs={'username': self.user.username})
|
||||
|
||||
def is_staff(self):
|
||||
return self.user.is_superuser or self.topic_set.exists()
|
||||
return self.user.is_superuser or self.orga or self.topic_set.exists()
|
||||
|
||||
|
||||
def create_profile(sender, instance, created, **kwargs):
|
||||
|
|
|
@ -62,7 +62,7 @@ class Talk(PonyConfModel):
|
|||
participation = Participation.on_site.get(user=user)
|
||||
except Participation.DoesNotExists:
|
||||
return False
|
||||
return self.topics.filter(reviewers=participation).exists()
|
||||
return participation.orga or self.topics.filter(reviewers=participation).exists()
|
||||
|
||||
|
||||
class Speech(PonyConfModel):
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
<a href="{% url 'show-speaker' speaker.username %}">{{ speaker }}</a>
|
||||
{% if forloop.revcounter == 2 %} and {% elif not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
<i>in</i>
|
||||
{% for topic in talk.topics.all %}
|
||||
<a href="{{ topic.get_absolute_url }}">{{ topic }}</a>
|
||||
{% if forloop.revcounter == 2 %} and {% elif not forloop.last %}, {% endif %}
|
||||
{% endfor %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
@ -22,9 +22,12 @@ def home(request):
|
|||
@login_required
|
||||
def talk_list(request):
|
||||
participation = Participation.on_site.get(user=request.user)
|
||||
other_talks = Talk.on_site.exclude(speakers=request.user)
|
||||
if not participation.orga:
|
||||
other_talks = other_talks.filter(topics__reviewers=participation)
|
||||
return render(request, 'proposals/talks.html', {
|
||||
'my_talks': Talk.on_site.filter(speakers=request.user),
|
||||
'other_talks': Talk.on_site.exclude(speakers=request.user).filter(topics__reviewers=participation),
|
||||
'other_talks': other_talks,
|
||||
})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue