created primary keys are not editable

This commit is contained in:
2023-11-15 17:54:06 +00:00
parent b4a288be0a
commit 71117b8e63

View File

@@ -312,18 +312,7 @@ class ResolutionAdminForm(forms.ModelForm):
class Meta: class Meta:
model = Resolution model = Resolution
fields = [ fields = "__all__"
"name",
"id",
"date",
"option",
"is_visible",
"budget",
"total",
"budget_remaining",
"voting",
"voting_text",
]
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) # to get the self.fields set super().__init__(*args, **kwargs) # to get the self.fields set
@@ -348,6 +337,12 @@ class ResolutionAdminForm(forms.ModelForm):
self.fields["budget_remaining"].label = "Restbudget (EUR)" self.fields["budget_remaining"].label = "Restbudget (EUR)"
self.fields["budget_remaining"].required = False self.fields["budget_remaining"].required = False
self.fields["budget"].required = False
if resolution is not None:
self.fields["id"].disabled = True
self.fields["id"].required = False
class WirefAdminForm(forms.ModelForm): class WirefAdminForm(forms.ModelForm):
total = forms.CharField() total = forms.CharField()