mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Re-added post_save method in AjaxCreateView
This commit is contained in:
parent
1e844c642f
commit
de2b7e5daf
@ -333,6 +333,12 @@ class AjaxCreateView(AjaxMixin, CreateView):
|
||||
- Handles form validation via AJAX POST requests
|
||||
"""
|
||||
|
||||
def post_save(self, **kwargs):
|
||||
"""
|
||||
Hook for doing something with the created object after it is saved
|
||||
"""
|
||||
pass
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
""" Creates form with initial data, and renders JSON response """
|
||||
|
||||
@ -386,6 +392,7 @@ class AjaxCreateView(AjaxMixin, CreateView):
|
||||
|
||||
# Save the object to the database
|
||||
self.object = self.save(self.form)
|
||||
self.post_save()
|
||||
|
||||
# Return the PK of the newly-created object
|
||||
data['pk'] = self.object.pk
|
||||
|
Loading…
Reference in New Issue
Block a user