Modal forms

* adds new POST functionality in NewStateModalForm, which does not use the super classes process_request() method
* adds explaining comments on the is_ajax() call
* updates translations
This commit is contained in:
mipel
2021-08-19 09:06:35 +02:00
parent 0c2d51b2b1
commit ec9eade111
4 changed files with 26 additions and 16 deletions

View File

@@ -173,6 +173,10 @@ class BaseModalForm(BaseForm, BSModalForm):
if request.method == "POST":
if self.is_valid():
if not is_ajax(request.META):
# Modal forms send one POST for checking on data validity. This can be used to return possible errors
# on the form. A second POST (if no errors occured) is sent afterwards and needs to process the
# saving/commiting of the data to the database. is_ajax() performs this check. The first request is
# an ajax call, the second is a regular form POST.
self.save()
messages.success(
request,