Skip to content

Commit

Permalink
rewrite get_name_of_model function
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtedn21 committed Nov 14, 2023
1 parent 65457d1 commit f12c9ab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions martin_eden/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@


def get_name_of_model(model_class: 'BaseModel') -> str:
model_name = model_class.__name__
# remove "Orm" postfix from model name
model_name = model_name[:-3]
model_name = model_name.lower()
return model_name
return (
getattr(model_class, '__entity_name__', '') or
getattr(model_class, '__tablename__', '') or
getattr(model_class, '__name__', '')
)


def get_argument_names(foo: Callable) -> tuple[str]:
Expand Down

0 comments on commit f12c9ab

Please sign in to comment.