Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Nounous
re2o
Commits
40247e32
Commit
40247e32
authored
Jun 30, 2018
by
chirac
Browse files
Merge branch 'Fix_109' into 'master'
Fix #109: Remove misnamed rights Closes #109 See merge request federez/re2o!179
parents
fdfd5629
3b2ca10e
Changes
1
Hide whitespace changes
Inline
Side-by-side
machines/migrations/0083_remove_duplicate_rights.py
0 → 100644
View file @
40247e32
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
def
remove_permission_alias
(
apps
,
schema_editor
):
Permission
=
apps
.
get_model
(
'auth'
,
'Permission'
)
for
codename
in
[
'add_alias'
,
'change_alias'
,
'delete_alias'
]:
# Retrieve the wrong permission
try
:
to_remove
=
Permission
.
objects
.
get
(
codename
=
codename
,
content_type__model
=
'domain'
)
except
Permission
.
DoesNotExist
:
# The permission is missing so no problem
pass
else
:
to_remove
.
delete
()
def
remove_permission_text
(
apps
,
schema_editor
):
Permission
=
apps
.
get_model
(
'auth'
,
'Permission'
)
for
codename
in
[
'add_text'
,
'change_text'
,
'delete_text'
]:
# Retrieve the wrong permission
try
:
to_remove
=
Permission
.
objects
.
get
(
codename
=
codename
,
content_type__model
=
'txt'
)
except
Permission
.
DoesNotExist
:
# The permission is missing so no problem
pass
else
:
to_remove
.
delete
()
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'machines'
,
'0082_auto_20180525_2209'
),
]
operations
=
[
migrations
.
RunPython
(
remove_permission_text
),
migrations
.
RunPython
(
remove_permission_alias
),
]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment