Skip to content

Commit

Permalink
Модель, миграции, админка
Browse files Browse the repository at this point in the history
Создали модель Task
Произвели миграции
Настроили подключение к админке: superuser (admin, admin)
  • Loading branch information
asmossunov committed Sep 19, 2022
1 parent 21bdc33 commit 92fb7f7
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
Empty file added identifier.sqlite
Empty file.
1 change: 1 addition & 0 deletions to_do_list/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'to_do'
]

MIDDLEWARE = [
Expand Down
23 changes: 23 additions & 0 deletions to_do_list/to_do/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2 on 2022-09-19 05:02

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Task',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('task_text', models.TextField(max_length=3000, verbose_name='Текст задачи')),
('state', models.CharField(default='new', max_length=300, verbose_name='Состояние')),
('deadline', models.DateTimeField(verbose_name='Дедлайн')),
],
),
]
9 changes: 8 additions & 1 deletion to_do_list/to_do/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
from django.db import models

# Create your models here.

class Task(models.Model):
task_text = models.TextField(verbose_name='Текст задачи', max_length=3000, null=False, blank=False)
state = models.CharField(verbose_name='Состояние', max_length=300, null=False, blank=False, default='new')
deadline = models.DateTimeField(verbose_name='Дедлайн')

def __str__(self):
return f'{self.task_text} {self.state} {self.deadline}'
Empty file.

0 comments on commit 92fb7f7

Please sign in to comment.