lab-1: add quiz models and migrations
This commit is contained in:
parent
98d7a05e8a
commit
c5ea3d0e44
5 changed files with 46 additions and 0 deletions
0
lab-1/quiz/__init__.py
Normal file
0
lab-1/quiz/__init__.py
Normal file
5
lab-1/quiz/apps.py
Normal file
5
lab-1/quiz/apps.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class QuizConfig(AppConfig):
|
||||
name = 'quiz'
|
||||
26
lab-1/quiz/migrations/0001_initial.py
Normal file
26
lab-1/quiz/migrations/0001_initial.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Generated by Django 6.0.3 on 2026-03-05 08:16
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Quiz',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=200)),
|
||||
('description', models.TextField()),
|
||||
('author', models.CharField(max_length=100)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('time_limit', models.IntegerField(help_text='Ограничение по времени в минутах')),
|
||||
('is_published', models.BooleanField(default=False)),
|
||||
],
|
||||
),
|
||||
]
|
||||
0
lab-1/quiz/migrations/__init__.py
Normal file
0
lab-1/quiz/migrations/__init__.py
Normal file
15
lab-1/quiz/models.py
Normal file
15
lab-1/quiz/models.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class Quiz(models.Model):
|
||||
title = models.CharField(max_length=200)
|
||||
description = models.TextField()
|
||||
author = models.CharField(max_length=100)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
time_limit = models.IntegerField(help_text='Ограничение по времени в минутах')
|
||||
is_published = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
Loading…
Add table
Reference in a new issue