spug/spug_api/apps/exec/models.py

23 lines
769 B
Python

from django.db import models
from libs import ModelMixin, human_time
from apps.account.models import User
class ExecTemplate(models.Model, ModelMixin):
name = models.CharField(max_length=50)
type = models.CharField(max_length=50)
body = models.TextField()
desc = models.CharField(max_length=255, null=True)
created_at = models.CharField(max_length=20, default=human_time)
created_by = models.ForeignKey(User, models.PROTECT, related_name='+')
updated_at = models.CharField(max_length=20, null=True)
updated_by = models.ForeignKey(User, models.PROTECT, related_name='+', null=True)
def __repr__(self):
return '<ExecTemplate %r>' % self.name
class Meta:
db_table = 'exec_templates'
ordering = ('-id',)