Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <QuerySet [<*CLASE*: *RESULTADO DE MI QUERY*>]>
- from django.db import models
- from django.utils.encoding import python_2_unicode_compatible
- from django.utils import timezone
- # Create your models here.
- class Usuario(models.Model):
- usuario_username = models.CharField(max_length=75)
- usuario_password = models.CharField(max_length=200)
- usuario_email = models.CharField(max_length=124)
- def __str__(self):
- return self.usuario_username
- class Tarea(models.Model):
- tarea_fecha_creacion = models.DateTimeField(default=timezone.now)
- tarea_titulo = models.CharField(max_length=75)
- tarea_descripcion = models.CharField(max_length=200)
- tarea_prioridad = models.IntegerField(default=0)
- tarea_fecha_objetivo = models.DateTimeField('Fecha objetivo',default=timezone.now)
- usuario = models.ForeignKey(Usuario, on_delete=models.CASCADE)
- def __str__(self):
- return self.tarea_titulo
- from django.shortcuts import render
- from django.http import HttpResponse
- from .models import Tarea, Usuario
- # Create your views here.
- from django.template import loader
- def index(request):
- template = loader.get_template('Todoer/index.html')
- latest_question_list = Tarea.objects.all()
- context = {'latest_question_list': latest_question_list}
- return render(request, 'Todoer/index.html', context)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement