Skip to content

Commit

Permalink
refactor: Updated import script for new model fields
Browse files Browse the repository at this point in the history
  • Loading branch information
hepplerj committed Jun 14, 2024
1 parent e027696 commit e91ba27
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
18 changes: 15 additions & 3 deletions manuscript/management/commands/load_manuscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ def load_data(self, filepath: str, sheet_name: str):
editorial_status_data_set = self.process_field(
row, "data_set", index
)
editorial_status_spatial_group = self.process_field(
row, "spatial_group", index
editorial_status_map_group = self.process_field(
row, "map_group", index
)
editorial_status_decorative_group = self.process_field(
row, "decorative_group", index
)

# Reference fields
Expand Down Expand Up @@ -237,6 +240,12 @@ def load_data(self, filepath: str, sheet_name: str):
decoration_tabriz_present = self.process_field(
row, "tabriz_present?", index
)
details_diagram_sun = self.process_field(
row, "diagram_4_(sun)?", index
)
details_gion_in_egypt = self.process_field(
row, "gion_in_egypt?", index
)

# Viewer Notes fields
viewer_notes_date_seen = self.process_field(row, "date_seen", index)
Expand Down Expand Up @@ -296,7 +305,8 @@ def load_data(self, filepath: str, sheet_name: str):
collated=editorial_status_collated,
spatial_priority=editorial_status_spatial_priority,
dataset=editorial_status_data_set,
group=editorial_status_spatial_group,
map_group=editorial_status_map_group,
decorative_group=editorial_status_decorative_group,
manuscript=manuscript,
)
editorial_status.save()
Expand Down Expand Up @@ -378,6 +388,8 @@ def load_data(self, filepath: str, sheet_name: str):
distance_lines=decoration_distance_lines,
distance_numbers=decoration_distance_numbers,
coat_of_arms=decoration_coat_of_arms,
gion_in_egypt=details_gion_in_egypt,
diagram_sun=details_diagram_sun,
manuscript=manuscript,
)
detail.save()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 5.0.2 on 2024-06-14 14:10

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("manuscript", "0075_remove_location_related_folio"),
]

operations = [
migrations.RenameField(
model_name="editorialstatus",
old_name="group",
new_name="decorative_group",
),
migrations.AddField(
model_name="detail",
name="diagram_sun",
field=models.CharField(blank=True, max_length=510, null=True),
),
migrations.AddField(
model_name="detail",
name="gion_in_egypt",
field=models.CharField(blank=True, max_length=510, null=True),
),
migrations.AddField(
model_name="editorialstatus",
name="map_group",
field=models.CharField(blank=True, max_length=255, null=True),
),
]

0 comments on commit e91ba27

Please sign in to comment.