Skip to content

Commit

Permalink
update to QuotaDefinitionUpdateForm queryset
Browse files Browse the repository at this point in the history
  • Loading branch information
CPrich905 committed Jan 9, 2025
1 parent 04385c8 commit ef3d0f4
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions quotas/forms/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Meta:
},
)
measurement_unit = forms.ModelChoiceField(
queryset=MeasurementUnit.objects.current(),
queryset=MeasurementUnit.objects.current().order_by("code"),
error_messages={"required": "Select the measurement unit"},
)
quota_critical_threshold = forms.DecimalField(
Expand Down Expand Up @@ -99,9 +99,6 @@ def clean(self):
return super().clean()

def init_fields(self):
self.fields["measurement_unit"].queryset = self.fields[
"measurement_unit"
].queryset.order_by("code")
self.fields["measurement_unit"].label_from_instance = (
lambda obj: f"{obj.code} - {obj.description}"
)
Expand Down

0 comments on commit ef3d0f4

Please sign in to comment.