class LearningContext(models.Model): learning_context_type = models.ForeignKey( 'LearningContextType', models.DO_NOTHING, db_column='learning_context_type_id') name = models.CharField(max_length=150, blank=True, null=True) short_code = models.CharField(max_length=25, blank=True, null=True) number = models.CharField(max_length=25, blank=True, null=True) active = models.NullBooleanField() exams = models.ManyToManyField('Exam', through='ExamAssociation', related_name='learningcontexts') question_sets = models.ManyToManyField('QuestionSet', through='QuestionSetAssociation') parent = models.ForeignKey('LearningContext', related_name='children', default=1, on_delete=models.DO_NOTHING) settings = JSONField(blank=True, null=True) meta = JSONField(blank=False, null=False, default={}) class Meta: managed = True db_table = 'LearningContext' def __str__(self): return "{}".format(self.name)
class User(AbstractUser): picture_id = models.CharField(max_length=100, blank=True, null=False, default="") student_id = models.CharField(max_length=9, blank=True, null=False, default="") password = models.CharField(max_length=255, blank=True, null=True, default="") phone = models.CharField(max_length=30, blank=True, null=True) email = models.EmailField(blank=True, null=False, default="") enrollments = models.ManyToManyField(to='LearningContext', through='Enrollment', related_name='enrollments') roles = models.ManyToManyField('Role', through='UserRole', related_name='user', db_column='role_id') settings = JSONField(blank=False, null=False, default={}) meta = JSONField(blank=False, null=False, default={}) class Meta: managed = True db_table = 'User'
class QuestionSet(models.Model): name = models.CharField(max_length=40, blank=True, null=True) questions = models.ManyToManyField('Question', through='QuestionSetQuestion', related_name='questions') settings = JSONField(blank=False, null=False, default={}) meta = JSONField(blank=False, null=False, default={}) class Meta: managed = True db_table = 'QuestionSet' def __str__(self): return "{}".format(self.name)
class Basic(models.Model): VIN = models.CharField(validators=[validate_vin], max_length=17, primary_key=True) year = models.PositiveSmallIntegerField(validators=[ MinValueValidator(1980), MaxValueValidator(datetime.now().year) ]) make = models.CharField(max_length=100) model = models.CharField(max_length=100) type = models.CharField(max_length=100) color = models.CharField(max_length=100, blank=True) dimensions = JSONField(blank=True) weight = JSONField(blank=True)
class Question(models.Model): question_type = models.ForeignKey('QuestionType', models.DO_NOTHING, db_column='question_type_id') sequence = models.IntegerField(blank=True, null=True) weight = models.IntegerField(blank=True, null=True) text = models.TextField(blank=True, null=True) settings = JSONField(blank=True, null=True) meta = JSONField(blank=False, null=False, default={}) class Meta: managed = True db_table = 'Question' def __str__(self): return "ID {}".format(self.id)
class TestModel(models.Model): test_django_jsonfield = JSONField( verbose_name="Test JSON", null=True, blank=True, help_text="Test JSON editor for the django postgres-specific JSONField" )
class BaseProduct(models.Model): # MALE = # FEMALE = #SEX_CHOICES DEFAULT_SORT = '-popularity' name = models.CharField('Наименование', max_length=255, default='') categories = TreeManyToManyField('catalog.Category', related_name='base_products_list', blank=True, verbose_name='Категории') manual_categories = TreeManyToManyField('catalog.Category', related_name='manual_base_product_list', blank=True, verbose_name=' Категории добавленные вручную') remote_id = models.CharField('ID синхронизации', max_length=255, unique=True) brand = models.ForeignKey(Brand, on_delete=models.SET_NULL, related_name='products_list', blank=True, null=True) article = models.CharField('Артикул',max_length=255, default='', blank=True, null=True) colors = models.ManyToManyField(Color, related_name='products_list', blank=True, verbose_name='Цвета') sex = models. CharField('Пол', max_length=255, default='', blank=True) #choises = SEX_CHOICES materials = models.ManyToManyField(Material, related_name='product_list', blank=True, verbose_name='Материалы') prints = models.ManyToManyField(Print, related_name='product_list') attributes = JSONField('Дополнительные характеристики', default=dict, blank=True) is_sublimation = models.BooleanField('Сублимация', default=False) is_active = models.BooleanField('Активен', default=True) is_new = models.BooleanField('Новинка', default=False) importer = models.ForeignKey(Importer, on_delete=models.SET_NULL, related_name='product_list', null=True, verbose_name='Поставщик') #TODO возможно стоит заменить на M2M popularity = models.PositiveIntegerField('Популярность', default=0, blank=True) class Meta: verbose_name = 'Базовый товар' verbose_name_plural = 'Базовые товары' ordering = ('name',) def __str__(self): return self.name if self.name else ''
class ZoneModel(BaseModel): name = models.CharField('Name', max_length=60, blank=False, null=False) model = JSONField('Model', validators=[validate_zone], blank=False, null=False)
class TestSubModel2(models.Model): par = models.ForeignKey(TestModel) test_inline_json_field = JSONField( verbose_name="Test JSON", null=True, blank=True, help_text="Test JSON editor for the django postgres-specific JSONField" )
class LearningContextType(models.Model): type = models.CharField(max_length=50, blank=True, null=True) description = models.CharField(max_length=150, blank=True, null=True) meta = JSONField(blank=False, null=False, default={}) class Meta: managed = True db_table = 'LearningContextType' def __str__(self): return "{}".format(self.type)
class SiteComputer(models.Model): site = models.ForeignKey('Site', models.DO_NOTHING, db_column='site_id') name = models.CharField(max_length=30, blank=True, null=True) certificate = models.TextField(blank=True, null=True) active = models.NullBooleanField() settings = JSONField(blank=True, null=True) class Meta: managed = True db_table = 'SiteComputer' def __str__(self): return "{}".format(self.name)
class ProctorAssociation(models.Model): proctor = models.ForeignKey('Proctor', models.DO_NOTHING, db_column='proctor_id', related_name='associated') user = models.ForeignKey('User', models.DO_NOTHING, db_column='user_id') settings = JSONField(blank=True, null=True) class Meta: managed = True db_table = 'ProctorAssociation' def __str__(self): return "{}".format(self.proctor) + " - {}".format(self.user)
class Site(models.Model): name = models.CharField(max_length=30, blank=True, null=True) location = models.CharField(max_length=80, blank=True, null=True) description = models.TextField(blank=True, null=True) size = models.SmallIntegerField(blank=True, null=True) require_checkin = models.NullBooleanField() settings = JSONField(blank=True, null=True) class Meta: managed = True db_table = 'Site' def __str__(self): return "{}".format(self.name)
class LearningContextTerm(models.Model): learning_context = models.ForeignKey('LearningContext', models.DO_NOTHING, db_column='learning_context_id') term = models.ForeignKey('Term', models.DO_NOTHING, db_column='term_id') override_start_date = models.DateTimeField(blank=True, null=True) override_end_date = models.DateTimeField(blank=True, null=True) meta = JSONField(blank=False, null=False, default={}) class Meta: managed = True db_table = 'LearningContextTerm' def __str__(self): return "{}".format(self.name)
class Term(models.Model): name = models.CharField(max_length=60, blank=True, null=True) term_code = models.CharField(max_length=25, blank=True, null=True, unique=True) start_date = models.DateTimeField(blank=True, null=True) end_date = models.DateTimeField(blank=True, null=True) meta = JSONField(blank=False, null=False, default={}) class Meta: managed = True db_table = 'Term' def __str__(self): return "{}".format(self.name)
class SecurityAuditLog(models.Model): user = models.ForeignKey('User', models.DO_NOTHING, db_column='user_id') ip_address = models.GenericIPAddressField(null=False, blank=False) action = models.CharField(max_length=100, blank=True, null=False, default="") resource = models.CharField(max_length=100, blank=True, null=False, default="") identifier = models.BigIntegerField(null=True, default=-1) params = JSONField(blank=False, null=False, default={}) time = models.DateTimeField(auto_now_add=True) def __str__(self): return "User - {}".format(self.user) + " - Resource {}".format( self.resource)
class Product(models.Model): """Product model""" STATUS_CHOICE_NEW = 'NEW' STATUS_CHOICE_PROGRESS = 'PROGRESS' STATUS_CHOICE_DONE = 'DONE' STATUS_CHOICE_ERROR = 'ERROR' STATUS_CHOICES = ( (STATUS_CHOICE_NEW, 'Новый'), (STATUS_CHOICE_PROGRESS, 'В обработке'), (STATUS_CHOICE_DONE, 'Закончен'), (STATUS_CHOICE_ERROR, 'Ошибка') ) status = models.CharField(verbose_name='Статус', max_length=255, choices=STATUS_CHOICES, default=STATUS_CHOICE_NEW) is_active = models.BooleanField(verbose_name='Активен', default=True) category = models.ForeignKey(Category, verbose_name='Категория', on_delete=models.CASCADE) page = models.ForeignKey(Page, verbose_name='Страница', on_delete=models.SET_NULL, blank=True, null=True) link = models.TextField(verbose_name='Ссылка для сбора') name = models.CharField(verbose_name='Название', max_length=255, blank=True, null=True) name_url = models.CharField(verbose_name='Название url', max_length=255, blank=True, null=True) name_url_color = models.CharField(verbose_name='Название url + цвет', max_length=255, blank=True, null=True) front_picture = models.TextField(verbose_name='Передний план', validators=[URLValidator], blank=True, null=True) back_picture = models.TextField(verbose_name='Задний план', validators=[URLValidator], blank=True, null=True) price = models.DecimalField(verbose_name='Цена', max_digits=12, decimal_places=2, blank=True, null=True) attributes = JSONField(verbose_name='Атрибуты', blank=True, null=True) # colors, sizes description_html = models.TextField(verbose_name='Html описание', blank=True, null=True) description_text = models.TextField(verbose_name='Текстовое описание', blank=True, null=True) manufacturer = models.CharField(verbose_name='Производитель', max_length=255, blank=True, null=True) created_at = models.DateTimeField(verbose_name='Дата создания', auto_now_add=True) updated_at = models.DateTimeField(verbose_name='Дата обновления', auto_now=True) class Meta: """Meta""" verbose_name = 'Продукт' verbose_name_plural = 'Продукты' def __str__(self): return f"{self.name}"
class Proctor(models.Model): user = models.ForeignKey('User', models.DO_NOTHING, db_column='user_id') first_name = models.CharField(max_length=50, blank=True, null=True) last_name = models.CharField(max_length=50, blank=True, null=True) position = models.CharField(max_length=50, blank=True, null=True) institution = models.CharField(max_length=50, blank=True, null=True) street = models.CharField(max_length=80, blank=True, null=True) zip = models.CharField(max_length=10, blank=True, null=True) email = models.CharField(max_length=55, blank=True, null=True) phone = models.CharField(max_length=30, blank=True, null=True) fax = models.CharField(max_length=30, blank=True, null=True) settings = JSONField(blank=True, null=True, default={'fee': ''}) class Meta: managed = True db_table = 'Proctor' def __str__(self): return "{}".format(self.first_name) + " {}".format(self.last_name)
class QuestionResponse(models.Model): result = models.ForeignKey('Result', models.DO_NOTHING, db_column='result_id') question = models.ForeignKey('Question', models.DO_NOTHING, db_column='question_id') score = models.FloatField(blank=True, null=True) graded = models.NullBooleanField() settings = JSONField(blank=False, null=False, default={ 'response': '', 'bookmarked': False }) class Meta: managed = True db_table = 'QuestionResponse' def __str__(self): return "ID {}".format(self.id)
class Result(models.Model): exam = models.ForeignKey('Exam', models.DO_NOTHING, db_column='exam_id') user = models.ForeignKey('User', models.DO_NOTHING, db_column='user_id') site = models.ForeignKey('Site', models.DO_NOTHING, db_column='site_id') start_time = models.DateTimeField(blank=True, null=True) duration = models.IntegerField(blank=True, null=True) score = models.FloatField(blank=True, null=True) score_sent = models.DateTimeField(blank=True, null=True) archived = models.NullBooleanField() settings = JSONField(blank=False, null=False, default={ 'questions': [], 'examsettings': {} }) class Meta: managed = True db_table = 'Result' def __str__(self): return "{}".format(self.exam) + " - {}".format( self.user) + " - Result {}".format(self.id)
class ProctorExamRequest(models.Model): user = models.ForeignKey('User', models.DO_NOTHING, db_column='user_id') proctor = models.ForeignKey('Proctor', models.DO_NOTHING, db_column='proctor_id') exam = models.ForeignKey('Exam', models.DO_NOTHING, db_column='exam_id') request_date = models.DateTimeField(blank=True, null=True) comments = models.TextField(blank=True, null=True) special_instructions = models.TextField(blank=True, null=True) request_password = models.TextField(blank=True, null=True) certify_score = models.CharField(max_length=5, blank=True, null=True) result = models.ForeignKey('Result', models.DO_NOTHING, db_column='result_id', null=True, blank=True) settings = JSONField(blank=True, null=True) class Meta: managed = True db_table = 'ProctorExamRequest' def __str__(self): return "ID {}".format(self.id)
class Exam(models.Model): name = models.CharField(max_length=150, blank=True, null=True) created = models.DateTimeField(auto_now_add=True) exam_type = models.ForeignKey('ExamType', models.DO_NOTHING, db_column='exam_type_id') archived = models.NullBooleanField() questionsets = models.ManyToManyField('QuestionSet', through='ExamQuestionSet', related_name='exams') settings = JSONField(blank=False, null=False, default={ 'Notifications': { 'studentReminders': False, 'beforeExamOpens': 0, 'beforeExamClosesSelect': 'Days', 'emailInExam': False, 'instructorNotifications': False, 'beforeExamOpensSelect': 'Days', 'beforeExamCloses': 0, 'messageGroup': 'standard', 'customMessage': '' }, 'QuestionSequence': [], 'Security': { 'audienceGroup': 'aud', 'privacy': False, 'password': '', 'attempts': 1 }, 'Audience': { 'targetedContexts': [] }, 'ExamInfo': { 'instructionsToStudents': 'Some instructions to the students!', 'dateRange': { 'to': '', 'from': '' }, 'type': 'online', 'instructionsToSelf': '', 'scoreReductionDate': None, 'owner': '', 'instructionsToOther': '', 'timeLimit': None, 'returnURL': '', 'consentGroup': 'yes', 'linkToExam': '' }, 'Sites': { 'targetedSites': [] }, 'Sharing': { 'targetedUsers': [] }, 'ExamAids': { 'keepNotes': False, 'cueSheets': '', 'materials': [], 'calculators': [], 'dictionaries': [], 'personalNotes': '', 'restroomBreak': False, 'whitelistedSites': [], 'openBookName': '', 'otherCalculator': '' }, 'Feedback': { 'allowViewScore': False, 'duringReview': False, 'scoreLessThanAboveFeedback': '', 'scoreFeedback': [], 'duringExam': False }, 'Review': { 'whenGroup': 'any-time', 'allowDownload': False, 'allowReviewQuestionsMissed': True, 'timeLimit': '', 'showCorrectAnswers': False, 'timeLimitIdentifier': '', 'allowReviewOfExam': False, 'allowReviewAnyComputer': True, 'allowReviewWithoutPassword': False }, 'Questions': { 'receiveQuestionGroup': 'all', 'numQuestionsRandomlySelected': 0, 'questionSets': [], 'presentationGroup': 'one', 'additional': ['go-back'] } }) meta = JSONField(blank=False, null=False, default={}) class Meta: managed = True db_table = 'Exam' def __str__(self): return "{}".format(self.name)
class SecurityAttributes(models.Model): attribute = models.CharField(max_length=100, blank=False, null=False) value = JSONField(blank=False, null=False, default={})