add lots in create or update lot views

This commit is contained in:
Cayo Puigdefabregas 2022-01-12 19:44:10 +01:00
parent d6dd740142
commit 18fc0e6e5b
1 changed files with 4 additions and 2 deletions

View File

@ -77,7 +77,8 @@ class LotCreateView(View):
next_url = url_for('inventory.devices.lotdevicelist', id=form.instance.id) next_url = url_for('inventory.devices.lotdevicelist', id=form.instance.id)
return flask.redirect(next_url) return flask.redirect(next_url)
return flask.render_template(self.template_name, form=form, title=self.title) lots = Lot.query.filter(Lot.owner_id == current_user.id)
return flask.render_template(self.template_name, form=form, title=self.title, lots=lots)
class LotUpdateView(View): class LotUpdateView(View):
@ -93,7 +94,8 @@ class LotUpdateView(View):
next_url = url_for('inventory.devices.lotdevicelist', id=id) next_url = url_for('inventory.devices.lotdevicelist', id=id)
return flask.redirect(next_url) return flask.redirect(next_url)
return flask.render_template(self.template_name, form=form, title=self.title) lots = Lot.query.filter(Lot.owner_id == current_user.id)
return flask.render_template(self.template_name, form=form, title=self.title, lots=lots)
class LotDeleteView(View): class LotDeleteView(View):