You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

managers.py 408B

1234567891011121314
  1. from django.db import models
  2. class CommunicationTypeManager(models.Manager):
  3. def get_and_render(self, code, context):
  4. """
  5. Return a dictionary of rendered messages, ready for sending
  6. """
  7. try:
  8. commtype = self.get(code=code)
  9. except self.model.DoesNotExist:
  10. commtype = self.model(code=code)
  11. return commtype.get_messages(context)