-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: buildingsync column mapping presets (#2213)
* feat: column mapping presets for buildingsync * fix: address PR comments * chore: add units for bsync columns * chore: fix migrations * chore: address PR comments * chore: allow changing from_units for bsync custom presets Co-authored-by: Adrian Lara <30608004+adrian-lara@users.noreply.github.com>
- Loading branch information
1 parent
d8a8ec6
commit f15fa05
Showing
26 changed files
with
909 additions
and
159 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
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,34 @@ | ||
# Generated by Django 2.2.10 on 2020-05-01 21:24 | ||
|
||
from django.db import migrations, models | ||
|
||
from seed.lib.xml_mapping.mapper import default_buildingsync_preset_mappings | ||
|
||
|
||
def create_default_bsync_presets(apps, schema_editor): | ||
"""create a default BuildingSync column mapping preset for each organization""" | ||
Organization = apps.get_model("orgs", "Organization") | ||
|
||
for org in Organization.objects.all(): | ||
bsync_mapping_name = 'BuildingSync v2.0 Defaults' | ||
org.columnmappingpreset_set.create( | ||
name=bsync_mapping_name, | ||
mappings=default_buildingsync_preset_mappings(), | ||
preset_type=1 | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('seed', '0125_dq_refactor'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='columnmappingpreset', | ||
name='preset_type', | ||
field=models.IntegerField(choices=[(0, 'Normal'), (1, 'BuildingSync Default'), (2, 'BuildingSync Custom')], default=0), | ||
), | ||
migrations.RunPython(create_default_bsync_presets), | ||
] |
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
Oops, something went wrong.