2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-05 21:20:56 +00:00

Add 'user' field to attachment

This commit is contained in:
Oliver Walters
2020-05-12 20:50:03 +10:00
parent 2948dad831
commit d4fa7d936e
7 changed files with 99 additions and 1 deletions

View File

@ -160,6 +160,12 @@ class StockItemAttachmentCreate(AjaxCreateView):
ajax_form_title = _("Add Stock Item Attachment")
ajax_template_name = "modal_form.html"
def post_save(self, **kwargs):
""" Record the user that uploaded the attachment """
self.object.user = self.request.user
self.object.save()
def get_data(self):
return {
'success': _("Added attachment")