-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
121 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.0.0 | ||
2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
molo/commenting/migrations/0005_add_commenting_permissions_to_groups.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.9 on 2016-10-23 12:29 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
from django.core.management.sql import emit_post_migrate_signal | ||
|
||
|
||
class Migration(migrations.Migration): | ||
def add_commenting_permissions_to_groups(apps, schema_editor): | ||
db_alias = schema_editor.connection.alias | ||
try: | ||
# Django 1.9 | ||
emit_post_migrate_signal(2, False, db_alias) | ||
except TypeError: | ||
# Django < 1.9 | ||
try: | ||
# Django 1.8 | ||
emit_post_migrate_signal(2, False, 'default', db_alias) | ||
except TypeError: # Django < 1.8 | ||
emit_post_migrate_signal([], 2, False, 'default', db_alias) | ||
|
||
Group = apps.get_model('auth.Group') | ||
Permission = apps.get_model('auth.Permission') | ||
GroupPagePermission = apps.get_model('wagtailcore.GroupPagePermission') | ||
|
||
if Group.objects.all().filter(name='Comment Moderator'): | ||
Group.objects.get(name='Comment Moderator').delete() | ||
|
||
if Group.objects.all().filter(name='Expert'): | ||
Group.objects.get(name='Expert').delete() | ||
|
||
|
||
# Create groups | ||
|
||
access_admin = Permission.objects.get(codename='access_admin') | ||
|
||
# <- Moderator -> | ||
moderator_group = Group.objects.get(name='Moderators') | ||
|
||
add_cannedresponse = Permission.objects.get( | ||
codename='add_cannedresponse') | ||
change_cannedresponse = Permission.objects.get( | ||
codename='change_cannedresponse') | ||
delete_cannedresponse = Permission.objects.get( | ||
codename='delete_cannedresponse') | ||
add_molocomment = Permission.objects.get( | ||
codename='add_molocomment') | ||
delete_molocomment = Permission.objects.get( | ||
codename='delete_molocomment') | ||
moderator_group.permissions.add( | ||
add_cannedresponse, delete_cannedresponse, | ||
change_cannedresponse, add_molocomment, delete_molocomment) | ||
|
||
# <- Comment Moderator -> | ||
comment_moderator_group, _created = Group.objects.get_or_create(name='Comment Moderator') | ||
comment_moderator_group.permissions.add(access_admin) | ||
change_user = Permission.objects.get( | ||
codename='change_user') | ||
comment_moderator_group.permissions.add(change_user, | ||
add_cannedresponse, add_molocomment, delete_molocomment) | ||
|
||
# <- Expert -> | ||
expert_group, _created = Group.objects.get_or_create(name='Expert') | ||
expert_group.permissions.add(access_admin) | ||
expert_group.permissions.add(add_molocomment) | ||
|
||
dependencies = [ | ||
('commenting', '0004_auto_20160713_0221'), | ||
('core', '0047_add_core_permissions_to_groups'), | ||
('contenttypes', '__latest__'), | ||
('sites', '__latest__'), | ||
('auth', '__latest__'), | ||
('wagtailcore', '__latest__'), | ||
('wagtailadmin', '__latest__'), | ||
('wagtailusers', '__latest__'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(add_commenting_permissions_to_groups), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
molo.core | ||
molo.core<5.0.0,>=4.0.0 | ||
django-contrib-comments==1.7.1 | ||
django-mptt==0.8.5 | ||
django-import-export | ||
wagtailmodeladmin | ||
django-daterange-filter |