attachment.py 836 B

123456789101112131415161718192021222324252627282930
  1. from .model import model
  2. from .proxy import proxy
  3. from .field_generator import field_generator
  4. from .constants import constants
  5. from .validators import validators
  6. class attachment(model):
  7. id = field_generator.id()
  8. name = field_generator.name()
  9. description = field_generator.description()
  10. def _validators(self) -> dict:
  11. return {
  12. "name": validators.name,
  13. "description": validators.description
  14. }
  15. class attachment_proxy(proxy):
  16. @classmethod
  17. def create(cls, name: str) -> proxy:
  18. return cls(attachment(
  19. name = name,
  20. description = constants.empty_text()
  21. ))
  22. def set_name(self, target: str) -> None:
  23. self._target.name = target
  24. def set_description(self, target: str) -> None:
  25. self._target.description = target