change devices for tags in printlabels

This commit is contained in:
Cayo Puigdefabregas 2022-04-27 18:55:27 +02:00
parent f299367ba7
commit bf42a79ef7
2 changed files with 3 additions and 6 deletions

View File

@ -64,10 +64,7 @@ class PrintLabelsForm(FlaskForm):
.all()
)
# print only tags that are DHID
dhids = [x.devicehub_id for x in self._devices]
self._tags = (
Tag.query.filter(Tag.owner_id == g.user.id).filter(Tag.id.in_(dhids)).all()
)
if not self._devices:
return False
return is_valid

View File

@ -102,7 +102,7 @@ class PrintLabelsView(View):
form = PrintLabelsForm()
if form.validate_on_submit():
context['form'] = form
context['tags'] = form._tags
context['devices'] = form._devices
return flask.render_template(self.template_name, **context)
else:
messages.error('Error you need select one or more devices')