Skip to content
Snippets Groups Projects
Commit 1075db32 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch 'bugfix/extensible-model-use-provided-name' into 'master'

Use provided name in ExtensibleModel methods

See merge request AlekSIS/official/AlekSIS!306
parents 7af38001 9b64c41e
No related branches found
No related tags found
1 merge request!306Use provided name in ExtensibleModel methods
Pipeline #2668 failed
......@@ -164,17 +164,17 @@ class ExtensibleModel(models.Model, metaclass=_ExtensibleModelBase):
@classmethod
def property_(cls, func: Callable[[], Any], name: Optional[str] = None) -> None:
"""Add the passed callable as a property."""
cls._safe_add(property(func), func.__name__)
cls._safe_add(property(func), name or func.__name__)
@classmethod
def method(cls, func: Callable[[], Any], name: Optional[str] = None) -> None:
"""Add the passed callable as a method."""
cls._safe_add(func, func.__name__)
cls._safe_add(func, name or func.__name__)
@classmethod
def class_method(cls, func: Callable[[], Any], name: Optional[str] = None) -> None:
"""Add the passed callable as a classmethod."""
cls._safe_add(classmethod(func), func.__name__)
cls._safe_add(classmethod(func), name or func.__name__)
@classmethod
def field(cls, **kwargs) -> None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment