diff --git a/src/django_routify/_abstraction.py b/src/django_routify/_abstraction.py index 10ed44b..7474f39 100644 --- a/src/django_routify/_abstraction.py +++ b/src/django_routify/_abstraction.py @@ -111,3 +111,19 @@ def route(self, url_path: str, name: str = None): :return: Any ''' ... + + @abstractmethod + def __str__(self) -> str: + ''' + Router string representation + :return: str + ''' + ... + + @abstractmethod + def __repr__(self) -> str: + ''' + Router string representation + :return: str + ''' + ... diff --git a/src/django_routify/router.py b/src/django_routify/router.py index 3647d61..ee04214 100644 --- a/src/django_routify/router.py +++ b/src/django_routify/router.py @@ -94,3 +94,13 @@ def register(view: FUNC_VIEW | View) -> FUNC_VIEW | View: return view return register + + def __str__(self) -> str: + return f'Router(\n' \ + f'\tapp_name:\t"{self.__app_name}"\n' \ + f'\turl_prefix:\t"{self.__prefix}"\n' \ + f'\turls:\t\t{self.__urls}\n' \ + f')' + + def __repr__(self) -> str: + return str(self)