|
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_models_ext import BaseModelMixin
from jsonfield import JSONField
from shortuuidfield import ShortUUIDField
class BranchCampusInfo(BaseModelMixin):
campus_id = ShortUUIDField(_('campus_id'), max_length=32, blank=True, null=True, help_text='分院唯一标识', db_index=True, unique=True)
campus_name = models.CharField(_('campus_name'), max_length=255, blank=True, null=True, help_text='分院名称')
class Meta:
verbose_name = _('分院信息')
verbose_name_plural = _('分院信息')
def __unicode__(self):
return '%d' % self.pk
class BranchCampusAdministratorInfo(BaseModelMixin):
PENDING = 0
ACTIVATED = 1
DISABLED = 2
DELETED = 3
USER_STATUS_TUPLE = (
(PENDING, '待审核'),
(ACTIVATED, '已激活'),
(DISABLED, '已禁用'),
(DELETED, '已删除'),
)
admin_id = ShortUUIDField(_('admin_id'), max_length=32, blank=True, null=True, help_text='管理员唯一标识', db_index=True, unique=True)
campus_id = models.CharField(_('campus_id'), max_length=32, blank=True, null=True, help_text='分院唯一标识', db_index=True)
campus_name = models.CharField(_('campus_name'), max_length=255, blank=True, null=True, help_text='分院名称')
name = models.CharField(_('name'), max_length=255, blank=True, null=True, help_text='管理员姓名')
phone = models.CharField(_('phone'), max_length=11, blank=True, null=True, help_text='管理员电话', db_index=True)
user_status = models.IntegerField(_('user_status'), choices=USER_STATUS_TUPLE, default=PENDING, help_text='管理员状态', db_index=True)
class Meta:
verbose_name = _(u'分院管理员信息')
verbose_name_plural = _(u'分院管理员信息')
def __unicode__(self):
return '%d' % self.pk
class CourseInfo(BaseModelMixin):
course_id = ShortUUIDField(_('course_id'), max_length=32, blank=True, null=True, help_text='课程唯一标识', db_index=True, unique=True)
course_name = models.CharField(_('course_name'), max_length=255, blank=True, null=True, help_text='课程名称')
# TODO:权限
class Meta:
verbose_name = _('课程信息')
verbose_name_plural = _('课程信息')
def __unicode__(self):
return '%d' % self.pk
class CourseRegisterFieldInfo(BaseModelMixin):
field_id = ShortUUIDField(_('field_id'), max_length=32, blank=True, null=True, help_text='字段唯一标识', db_index=True, unique=True)
course_id = models.CharField(_('course_id'), max_length=32, blank=True, null=True, help_text='课程唯一标识', db_index=True)
course_name = models.CharField(_('course_name'), max_length=255, blank=True, null=True, help_text='课程名称')
# {
# "type": "input", # input, select, file
# "name": "",
# "options": ["男", "女"], # type=select
# }
fields = JSONField(_('fields'), default=[], blank=True, null=True, help_text='字段列表')
class Meta:
verbose_name = _('课程报名字段信息')
verbose_name_plural = _('课程报名字段信息')
def __unicode__(self):
return '%d' % self.pk
class CourseRegisterInfo(BaseModelMixin):
field_id = models.CharField(_('field_id'), max_length=32, blank=True, null=True, help_text='字段唯一标识', db_index=True)
course_id = models.CharField(_('course_id'), max_length=32, blank=True, null=True, help_text='课程唯一标识', db_index=True)
course_name = models.CharField(_('course_name'), max_length=255, blank=True, null=True, help_text='课程名称')
fields = JSONField(_('fields'), default=[], blank=True, null=True, help_text='字段信息')
class Meta:
verbose_name = _('课程报名信息')
verbose_name_plural = _('课程报名信息')
def __unicode__(self):
return '%d' % self.pk
|