models.py 927 B

12345678910111213141516171819202122232425
  1. # Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug
  2. # Copyright: (c) <spug.dev@gmail.com>
  3. # Released under the AGPL-3.0 License.
  4. from django.db import models
  5. from libs import ModelMixin, human_datetime
  6. from apps.account.models import User
  7. class ExecTemplate(models.Model, ModelMixin):
  8. name = models.CharField(max_length=50)
  9. type = models.CharField(max_length=50)
  10. body = models.TextField()
  11. desc = models.CharField(max_length=255, null=True)
  12. created_at = models.CharField(max_length=20, default=human_datetime)
  13. created_by = models.ForeignKey(User, models.PROTECT, related_name='+')
  14. updated_at = models.CharField(max_length=20, null=True)
  15. updated_by = models.ForeignKey(User, models.PROTECT, related_name='+', null=True)
  16. def __repr__(self):
  17. return '<ExecTemplate %r>' % self.name
  18. class Meta:
  19. db_table = 'exec_templates'
  20. ordering = ('-id',)