1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-07-01 17:15:42 +00:00

Fixe migrations for new deployments @Real-Gecko

This commit is contained in:
catborise 2020-06-02 13:26:37 +03:00
parent c39efd8a0b
commit 73dfdfed85
12 changed files with 93 additions and 107 deletions

View file

@ -1,25 +0,0 @@
from django.db import migrations
def apply_change_password(apps, schema_editor):
from django.conf import settings
from django.contrib.auth.models import User, Permission
if hasattr(settings, 'SHOW_PROFILE_EDIT_PASSWORD'):
if settings.SHOW_PROFILE_EDIT_PASSWORD:
permission = Permission.objects.get(codename='change_password')
users = User.objects.all()
user: User
for user in users:
user.user_permissions.add(permission)
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_permissionset'),
]
operations = [
migrations.RunPython(apply_change_password),
]