diff --git a/to_do_list/admin.py b/to_do_list/admin.py index 8c38f3f..daf4031 100644 --- a/to_do_list/admin.py +++ b/to_do_list/admin.py @@ -1,3 +1,14 @@ from django.contrib import admin +from .models import Tarefa -# Register your models here. + +class Tarefas(admin.ModelAdmin): + list_display = ("id", "titulo", "data", "concluida") + list_display_links = ("id", "titulo") + search_fields = ("titulo", ) + list_editable = ('concluida', ) + list_filter = ('concluida',) + list_per_page = 10 + + +admin.site.register(Tarefa, Tarefas) diff --git a/to_do_list/migrations/0001_initial.py b/to_do_list/migrations/0001_initial.py new file mode 100644 index 0000000..e5d4854 --- /dev/null +++ b/to_do_list/migrations/0001_initial.py @@ -0,0 +1,25 @@ +# Generated by Django 4.0.1 on 2022-12-24 03:33 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Tarefa', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('titulo', models.CharField(max_length=100)), + ('data', models.DateField(blank=True, default=datetime.datetime(2022, 12, 24, 0, 33, 24, 242740))), + ('concluida', models.BooleanField(default=False)), + ('descricao', models.TextField(blank=True, max_length=500)), + ], + ), + ] diff --git a/to_do_list/migrations/0002_alter_tarefa_data.py b/to_do_list/migrations/0002_alter_tarefa_data.py new file mode 100644 index 0000000..089fa11 --- /dev/null +++ b/to_do_list/migrations/0002_alter_tarefa_data.py @@ -0,0 +1,19 @@ +# Generated by Django 4.0.1 on 2022-12-24 03:41 + +import datetime +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('to_do_list', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='tarefa', + name='data', + field=models.DateField(blank=True, default=datetime.datetime(2022, 12, 24, 0, 41, 54, 367897)), + ), + ] diff --git a/to_do_list/models.py b/to_do_list/models.py index 71a8362..d8a59e4 100644 --- a/to_do_list/models.py +++ b/to_do_list/models.py @@ -1,3 +1,12 @@ from django.db import models +from datetime import datetime -# Create your models here. + +class Tarefa(models.Model): + titulo = models.CharField(max_length=100) + data = models.DateField(default=datetime.now(), blank=True) + concluida = models.BooleanField(default=False) + descricao = models.TextField(max_length=500, blank=True) + + def __str__(self): + return self.titulo