Minor fixes

This commit is contained in:
rizlas 2022-01-11 14:09:46 +01:00
parent 836d850401
commit 00cedbd589
2 changed files with 6 additions and 2 deletions

View File

@ -146,6 +146,10 @@ class PowerPortComparison(ParentTypedComparison):
and (self.allocated_draw == other.allocated_draw)
)
def __hash__(self):
# Ignore some fields when hashing; ignore interface name case and whitespaces
return hash((self.name.lower().replace(" ", ""), self.type))
@dataclass(frozen=True)
class PowerOutletComparison(ParentTypedComparison):

View File

@ -317,7 +317,7 @@ class PowerOutletComparisonView(LoginRequiredMixin, PermissionRequiredMixin, Vie
except ValueError:
pass
else:
message.append("Dependecy detected, sync power ports first!")
messages.error(request, "Dependecy detected, sync power ports first!")
if created > 0:
message.append(f"created {created} power outlet")
@ -450,7 +450,7 @@ class FrontPortComparisonView(LoginRequiredMixin, PermissionRequiredMixin, View)
except ValueError:
pass
else:
message.append("Dependecy detected, sync rear ports first!")
messages.error(request, "Dependecy detected, sync power ports first!")
if created > 0:
message.append(f"created {created} front ports")