fix tags in use
This commit is contained in:
parent
0f30bbda35
commit
0d99aa4984
|
@ -437,6 +437,10 @@ class TagDeviceForm(FlaskForm):
|
||||||
self._tag = Tag.query.filter(Tag.id == self.tag.data).filter(
|
self._tag = Tag.query.filter(Tag.id == self.tag.data).filter(
|
||||||
Tag.owner_id == g.user.id).one()
|
Tag.owner_id == g.user.id).one()
|
||||||
|
|
||||||
|
if not self.delete and self._tag.device_id:
|
||||||
|
self.tag.errors = [("This tag is actualy in use.")]
|
||||||
|
return False
|
||||||
|
|
||||||
if self.device.data:
|
if self.device.data:
|
||||||
try:
|
try:
|
||||||
self.device.data = int(self.device.data.split(',')[-1])
|
self.device.data = int(self.device.data.split(',')[-1])
|
||||||
|
|
Reference in a new issue