Merge pull request #65 from faulteh/speaker_deets_permission
Add a permission to view speaker contact details in conference.json
This commit is contained in:
commit
ae9f1e0b67
3 changed files with 22 additions and 2 deletions
|
@ -242,7 +242,7 @@ def schedule_json(request):
|
||||||
"authors": [s.name for s in slot.content.speakers()],
|
"authors": [s.name for s in slot.content.speakers()],
|
||||||
"contact": [
|
"contact": [
|
||||||
s.email for s in slot.content.speakers()
|
s.email for s in slot.content.speakers()
|
||||||
] if request.user.is_staff else ["redacted"],
|
] if request.user.has_perm('symposion_speakers.can_view_contact_details') or request.user.is_staff else ["redacted"],
|
||||||
"abstract": slot.content.abstract,
|
"abstract": slot.content.abstract,
|
||||||
"conf_url": "%s://%s%s" % (
|
"conf_url": "%s://%s%s" % (
|
||||||
protocol,
|
protocol,
|
||||||
|
@ -258,7 +258,7 @@ def schedule_json(request):
|
||||||
data.append(slot_data)
|
data.append(slot_data)
|
||||||
|
|
||||||
return HttpResponse(
|
return HttpResponse(
|
||||||
json.dumps({"schedule": data}),
|
json.dumps({"schedule": data}, indent=2),
|
||||||
content_type="application/json"
|
content_type="application/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
19
symposion/speakers/migrations/0002_auto_20161230_1900.py
Normal file
19
symposion/speakers/migrations/0002_auto_20161230_1900.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.7 on 2016-12-30 08:09
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('symposion_speakers', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='speaker',
|
||||||
|
options={'ordering': ['name'], 'permissions': (('can_view_contact_details', 'Can View Contact Details'),), 'verbose_name': 'Speaker', 'verbose_name_plural': 'Speakers'},
|
||||||
|
),
|
||||||
|
]
|
|
@ -105,6 +105,7 @@ class Speaker(models.Model):
|
||||||
ordering = ['name']
|
ordering = ['name']
|
||||||
verbose_name = _("Speaker")
|
verbose_name = _("Speaker")
|
||||||
verbose_name_plural = _("Speakers")
|
verbose_name_plural = _("Speakers")
|
||||||
|
permissions = (('can_view_contact_details', 'Can View Contact Details'),)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
self.biography_html = parse(self.biography)
|
self.biography_html = parse(self.biography)
|
||||||
|
|
Loading…
Reference in a new issue