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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user