When creating an export, set creator to current user

many exports won't support creation via web app, but some will
This commit is contained in:
Lance Edgar 2019-07-05 16:47:51 -05:00
parent 8c610e2142
commit c8d6361c36

View file

@ -133,6 +133,12 @@ class ExportMasterView(MasterView):
f.append('download') f.append('download')
f.set_renderer('download', self.render_download) f.set_renderer('download', self.render_download)
def objectify(self, form, data=None):
obj = super(ExportMasterView, self).objectify(form, data=data)
if self.creating:
obj.created_by = self.request.user
return obj
def render_download(self, export, field): def render_download(self, export, field):
path = self.get_file_path(export) path = self.get_file_path(export)
text = "{} ({})".format(export.filename, self.readable_size(path)) text = "{} ({})".format(export.filename, self.readable_size(path))