You've already forked Curso-lenguaje-python
5
python-total/dia_16/mi_web/src/proyecto/base/admin.py
Normal file
5
python-total/dia_16/mi_web/src/proyecto/base/admin.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.contrib import admin
|
||||
from .models import Tarea
|
||||
# Register your models here.
|
||||
|
||||
admin.site.register(Tarea)
|
||||
6
python-total/dia_16/mi_web/src/proyecto/base/apps.py
Normal file
6
python-total/dia_16/mi_web/src/proyecto/base/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class BaseConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'base'
|
||||
@@ -0,0 +1,31 @@
|
||||
# Generated by Django 4.2.1 on 2023-05-20 20:20
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Tarea',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('titulo', models.CharField(max_length=200)),
|
||||
('descripcion', models.TextField(blank=True, null=True)),
|
||||
('completo', models.BooleanField(default=False)),
|
||||
('creado', models.DateTimeField(auto_now_add=True)),
|
||||
('usuario', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['completo'],
|
||||
},
|
||||
),
|
||||
]
|
||||
26
python-total/dia_16/mi_web/src/proyecto/base/models.py
Normal file
26
python-total/dia_16/mi_web/src/proyecto/base/models.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
# Create your models here.
|
||||
|
||||
|
||||
class Tarea(models.Model):
|
||||
usuario = models.ForeignKey(
|
||||
User,
|
||||
on_delete=models.CASCADE,
|
||||
null=True,
|
||||
blank=True
|
||||
)
|
||||
titulo = models.CharField(max_length=200)
|
||||
descripcion = models.TextField(
|
||||
null=True,
|
||||
blank=True
|
||||
)
|
||||
completo = models.BooleanField(default=False)
|
||||
creado = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.titulo
|
||||
|
||||
class Meta:
|
||||
ordering = ['completo']
|
||||
3
python-total/dia_16/mi_web/src/proyecto/base/tests.py
Normal file
3
python-total/dia_16/mi_web/src/proyecto/base/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
7
python-total/dia_16/mi_web/src/proyecto/base/urls.py
Normal file
7
python-total/dia_16/mi_web/src/proyecto/base/urls.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.lista_pendientes, name='pendientes')
|
||||
]
|
||||
8
python-total/dia_16/mi_web/src/proyecto/base/views.py
Normal file
8
python-total/dia_16/mi_web/src/proyecto/base/views.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse
|
||||
|
||||
# Create your views here.
|
||||
|
||||
|
||||
def lista_pendientes(pedido):
|
||||
return HttpResponse('Lista de pendientes')
|
||||
@@ -37,6 +37,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'base.apps.BaseConfig',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
||||
@@ -15,8 +15,9 @@ Including another URLconf
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', include('base.urls')),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user