Skip to content

Commit d73ff86

Browse files
committed
fix: DEV-2687: Hide storage filename field for old projects (#2624)
* fix: DEV-2687: Display source filename for S3 objects * Move storage filename to separate field (DEV-2687) * fix: DEV-2687: Hide storage filename field for old projects
1 parent 3647fa4 commit d73ff86

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license.
2+
"""
3+
from django.db import migrations
4+
5+
6+
def remove(apps, schema_editor):
7+
View = apps.get_model('data_manager', 'View')
8+
views = View.objects.all()
9+
10+
for view in views:
11+
if 'hiddenColumns' in view.data:
12+
if 'explore' in view.data['hiddenColumns']:
13+
view.data['hiddenColumns']['explore'].append('tasks:storage_filename')
14+
view.data['hiddenColumns']['explore'] = list(set(view.data['hiddenColumns']['explore']))
15+
if 'labeling' in view.data['hiddenColumns']:
16+
view.data['hiddenColumns']['labeling'].append('tasks:storage_filename')
17+
view.data['hiddenColumns']['labeling'] = list(set(view.data['hiddenColumns']['labeling']))
18+
19+
view.save()
20+
21+
22+
def backwards(apps, schema_editor):
23+
View = apps.get_model('data_manager', 'View')
24+
views = View.objects.all()
25+
26+
for view in views:
27+
if 'hiddenColumns' in view.data:
28+
if 'explore' in view.data['hiddenColumns']:
29+
view.data['hiddenColumns']['explore'].remove('tasks:storage_filename')
30+
view.data['hiddenColumns']['explore'] = list(set(view.data['hiddenColumns']['explore']))
31+
if 'labeling' in view.data['hiddenColumns']:
32+
view.data['hiddenColumns']['labeling'].remove('tasks:storage_filename')
33+
view.data['hiddenColumns']['labeling'] = list(set(view.data['hiddenColumns']['labeling']))
34+
35+
view.save()
36+
37+
38+
class Migration(migrations.Migration):
39+
dependencies = [
40+
('data_manager', '0006_remove_inner_id'),
41+
]
42+
43+
operations = [
44+
migrations.RunPython(remove, backwards),
45+
]

0 commit comments

Comments
 (0)