Skip to content

Commit

Permalink
Merge pull request #2044 from laws-africa/remove-metadata-json
Browse files Browse the repository at this point in the history
Remove old_metadata_json field
  • Loading branch information
actlikewill authored Sep 18, 2024
2 parents 62fa6a6 + fc8d803 commit 2647b65
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
17 changes: 17 additions & 0 deletions peachjam/migrations/0159_remove_legislation_old_metadata_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.15 on 2024-09-17 05:08

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("peachjam", "0158_alter_legislation_old_metadata_json"),
]

operations = [
migrations.RemoveField(
model_name="legislation",
name="old_metadata_json",
),
]
7 changes: 1 addition & 6 deletions peachjam/models/generic_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,12 @@ def pre_save(self):
class LegislationManager(CoreDocumentManager):
def get_queryset(self):
# defer expensive fields
return (
super()
.get_queryset()
.defer("old_metadata_json", "timeline_json", "commencements_json")
)
return super().get_queryset().defer("timeline_json", "commencements_json")


class Legislation(CoreDocument):
objects = LegislationManager.from_queryset(CoreDocumentQuerySet)()

old_metadata_json = models.JSONField(_("metadata JSON"), null=True, blank=True)
timeline_json = models.JSONField(
_("timeline JSON"), null=False, blank=False, default=list
)
Expand Down

0 comments on commit 2647b65

Please sign in to comment.