forked from AFPy/PonyConf
superuser are automatically orga
This commit is contained in:
parent
e3f0c10439
commit
56be78ee0b
|
@ -57,5 +57,8 @@ class Participation(PonyConfModel):
|
|||
def get_absolute_url(self):
|
||||
return reverse('show-speaker', kwargs={'username': self.user.username})
|
||||
|
||||
def is_orga(self):
|
||||
return self.user.is_superuser or self.orga
|
||||
|
||||
def is_staff(self):
|
||||
return self.user.is_superuser or self.orga or self.topic_set.exists()
|
||||
return self.is_orga() or self.topic_set.exists()
|
||||
|
|
|
@ -7,7 +7,7 @@ def generate_user_uid():
|
|||
|
||||
|
||||
def is_orga(request, user):
|
||||
return user.is_authenticated() and user.participation_set.get(site=get_current_site(request)).orga
|
||||
return user.is_authenticated() and user.participation_set.get(site=get_current_site(request)).is_orga()
|
||||
|
||||
|
||||
def is_staff(request, user):
|
||||
|
|
|
@ -65,8 +65,9 @@ class ProposalsTests(TestCase):
|
|||
self.assertFalse(talk.is_moderable_by(b))
|
||||
|
||||
# Only orga can edit topics
|
||||
self.client.login(username='c', password='c')
|
||||
self.client.login(username='b', password='b')
|
||||
self.assertFalse(Participation.on_site.get(user=b).orga)
|
||||
self.assertEqual(self.client.get(reverse('edit-topic', kwargs={'slug': 'topipo'})).status_code, 302)
|
||||
Participation.on_site.filter(user=c).update(orga=True)
|
||||
Participation.on_site.filter(user=b).update(orga=True)
|
||||
self.assertEqual(self.client.get(reverse('edit-topic', kwargs={'slug': 'topipo'})).status_code, 200)
|
||||
self.assertEqual(self.client.get(reverse('list-topics')).status_code, 200)
|
||||
|
|
Loading…
Reference in New Issue
Block a user