Skip to content

Commit

Permalink
Merge pull request #2 from VictorGM01/modelo-da-tarefa
Browse files Browse the repository at this point in the history
Modelo da tarefa
  • Loading branch information
VictorGM01 authored Dec 24, 2022
2 parents 0e3e694 + 227a253 commit 9730e5d
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 2 deletions.
13 changes: 12 additions & 1 deletion to_do_list/admin.py
Original file line number Diff line number Diff line change
@@ -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)
25 changes: 25 additions & 0 deletions to_do_list/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -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)),
],
),
]
19 changes: 19 additions & 0 deletions to_do_list/migrations/0002_alter_tarefa_data.py
Original file line number Diff line number Diff line change
@@ -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)),
),
]
11 changes: 10 additions & 1 deletion to_do_list/models.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9730e5d

Please sign in to comment.