views: Allow AppViews to set self.intial

If a derived view simply sets self.initial instead of overriding get_initial(),
honor it just like Django's FormView does.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa 2020-03-11 15:40:04 -07:00 committed by Veiko Aasa
parent 39b6592e92
commit cd65c04719
No known key found for this signature in database
GPG Key ID: 478539CAE680674E

View File

@ -164,7 +164,9 @@ class AppView(FormView):
def get_initial(self):
"""Return the status of the app to fill in the form."""
return self._get_common_status()
initial = super().get_initial()
initial.update(self._get_common_status())
return initial
def form_valid(self, form):
"""Enable/disable a service and set messages."""