-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Tableau filters to embedded Visuals (#761)
* add a tableau filter * fix tests * add docstrings/tests * update wheel * fix PropTypes
- Loading branch information
1 parent
eb2b91c
commit f0c4317
Showing
11 changed files
with
210 additions
and
56 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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import json | ||
|
||
from django.db import migrations | ||
|
||
|
||
def forwards(apps, schema_editor): | ||
Visual = apps.get_model("summary", "visual") | ||
updates = [] | ||
for visual in Visual.objects.filter(visual_type=5): | ||
try: | ||
settings = json.loads(visual.settings) | ||
except json.JSONDecodeError: | ||
continue | ||
settings["filters"] = [] | ||
visual.settings = json.dumps(settings) | ||
updates.append(visual) | ||
if updates: | ||
Visual.objects.bulk_update(updates, ["settings"]) | ||
|
||
|
||
def backwards(apps, schema_editor): | ||
Visual = apps.get_model("summary", "visual") | ||
updates = [] | ||
for visual in Visual.objects.filter(visual_type=5): | ||
try: | ||
settings = json.loads(visual.settings) | ||
except json.JSONDecodeError: | ||
continue | ||
settings.pop("filters") | ||
visual.settings = json.dumps(settings) | ||
updates.append(visual) | ||
if updates: | ||
Visual.objects.bulk_update(updates, ["settings"]) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("summary", "0039_update_rob_legend"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(forwards, reverse_code=backwards), | ||
] |
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
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