Skip to content

Commit

Permalink
Get schemas on page load
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelglenister committed Nov 13, 2023
1 parent 9b424b5 commit 22ce835
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 10 additions & 6 deletions municipal_finance/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@


class FinPosForm(forms.ModelForm):
try:
most_recent_version = ItemCodeSchema.objects.latest("id")
except ItemCodeSchema.DoesNotExist:
most_recent_version = ""

version = forms.CharField(
initial=most_recent_version.version if most_recent_version else "",
disabled=True,
label="Schema version",
)

class Meta:
model = FinancialPositionFactsV2
fields = "__all__"

def __init__(self, *args, **kwargs):
super(FinPosForm, self).__init__(*args, **kwargs)
try:
most_recent_version = ItemCodeSchema.objects.latest("id")
except ItemCodeSchema.DoesNotExist:
most_recent_version = ""
self.fields["version"].initial = (
most_recent_version.version if most_recent_version else ""
)
1 change: 0 additions & 1 deletion municipal_finance/update/capital_facts_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class CapitalFactsV2Updater(Updater):
for item in ref_items:
item_map[str(item)] = item


def build_unique_query(self, rows):
return build_unique_query_params_with_period(rows)

Expand Down

0 comments on commit 22ce835

Please sign in to comment.