Skip to content

Commit

Permalink
changes to model
Browse files Browse the repository at this point in the history
now enforces name for mpsk client
refactoring changed name

Signed-off-by: Alex <[email protected]>
#744
  • Loading branch information
agmes4 committed Sep 15, 2024
1 parent 9ecb52b commit 2083840
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pycroft/lib/mpsk_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


@with_transaction
def host_delete(host: MSPKClient, processor: User) -> None:
def mpsk_delete(host: MSPKClient, processor: User) -> None:
message = deferred_gettext("Deleted host '{}'.").format(host.name)
log_user_event(author=processor, user=host.owner, message=message.to_json())

Expand All @@ -30,8 +30,8 @@ def change_mac(client: MSPKClient, mac: str, processor: User) -> MSPKClient:
old_mac = client.mac
client.mac = mac
message = deferred_gettext("Changed MAC address from {} to {}.").format(old_mac, mac)
if client.host.owner:
log_user_event(message.to_json(), processor, client.host.owner)
if client.owner:
log_user_event(message.to_json(), processor, client.owner)
return client


Expand Down
2 changes: 1 addition & 1 deletion pycroft/model/mspk_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class MSPKClient(IntegerIdModel):

name: Mapped[str | None] = mapped_column(String)
name: Mapped[str] = mapped_column(String, nullable=False)

owner_id: Mapped[int | None] = mapped_column(
ForeignKey(User.id, ondelete="CASCADE"), index=True
Expand Down

0 comments on commit 2083840

Please sign in to comment.