Skip to content

Commit

Permalink
Person title and user title and userprofile are now hybrid properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Tschuppi81 committed Jul 16, 2024
1 parent b8f3b76 commit 3beab01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/onegov/people/models/person.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from sqlalchemy.ext.hybrid import hybrid_property

from onegov.core.orm import Base
from onegov.core.orm.mixins import ContentMixin
from onegov.core.orm.mixins import TimestampMixin
Expand Down Expand Up @@ -55,7 +57,8 @@ class Person(Base, ContentMixin, TimestampMixin, ORMSearchable,
def es_suggestion(self) -> tuple[str, ...]:
return (self.title, f'{self.first_name} {self.last_name}')

@property
# @property
@hybrid_property
def title(self) -> str:
""" Returns the Eastern-ordered name. """

Expand Down
3 changes: 2 additions & 1 deletion src/onegov/user/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class User(Base, TimestampMixin, ORMSearchable):
def es_suggestion(self) -> tuple[str, str]:
return (self.realname or self.username, self.username)

@property
# @property
@hybrid_property
def userprofile(self) -> list[str]:
if not self.data:
return []
Expand Down

0 comments on commit 3beab01

Please sign in to comment.