1
|
|
|
# Generated by Django 2.1.5 on 2019-03-09 16:08 |
2
|
|
|
|
3
|
|
|
from django.db import migrations |
4
|
|
|
from django.conf import settings |
5
|
|
|
|
6
|
|
|
|
7
|
|
|
def rename_permissions(apps, schema_editor): |
8
|
|
|
Permission = apps.get_model('auth', 'Permission') |
9
|
|
|
|
10
|
|
|
for permission in Permission.objects.filter(codename__contains='testcaserun'): |
11
|
|
|
new_name = permission.name.replace('test case run', 'test execution') |
12
|
|
|
new_codename = permission.codename.replace('testcaserun', 'testexecution') |
13
|
|
|
|
14
|
|
|
permission.codename = new_codename |
15
|
|
|
permission.name = new_name |
16
|
|
|
permission.save() |
17
|
|
|
|
18
|
|
|
|
19
|
|
|
class Migration(migrations.Migration): |
20
|
|
|
atomic = False |
21
|
|
|
|
22
|
|
|
dependencies = [ |
23
|
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL), |
24
|
|
|
('testcases', '0008_notifications_default_true'), |
25
|
|
|
('management', '0005_order_by_name'), |
26
|
|
|
('testruns', '0005_remove_unused_fields'), |
27
|
|
|
] |
28
|
|
|
|
29
|
|
|
operations = [ |
30
|
|
|
migrations.RenameModel( |
31
|
|
|
old_name='TestCaseRun', |
32
|
|
|
new_name='TestExecution'), |
33
|
|
|
migrations.RenameModel( |
34
|
|
|
old_name='TestCaseRunStatus', |
35
|
|
|
new_name='TestExecutionStatus', |
36
|
|
|
), |
37
|
|
|
migrations.RenameModel( |
38
|
|
|
old_name='HistoricalTestCaseRun', |
39
|
|
|
new_name='HistoricalTestExecution', |
40
|
|
|
), |
41
|
|
|
migrations.AlterModelOptions( |
42
|
|
|
name='historicaltestexecution', |
43
|
|
|
options={ |
44
|
|
|
'get_latest_by': 'history_date', |
45
|
|
|
'ordering': ('-history_date', '-history_id'), |
46
|
|
|
'verbose_name': 'historical test execution' |
47
|
|
|
}, |
48
|
|
|
), |
49
|
|
|
migrations.RunPython(rename_permissions), |
50
|
|
|
] |
51
|
|
|
|