Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <QuerySet [<*CLASE*: *RESULTADO DE MI QUERY*>]>
  2.  
  3. from django.db import models
  4. from django.utils.encoding import python_2_unicode_compatible
  5. from django.utils import timezone
  6.  
  7. # Create your models here.
  8. class Usuario(models.Model):
  9. usuario_username = models.CharField(max_length=75)
  10. usuario_password = models.CharField(max_length=200)
  11. usuario_email = models.CharField(max_length=124)
  12. def __str__(self):
  13. return self.usuario_username
  14.  
  15.  
  16. class Tarea(models.Model):
  17. tarea_fecha_creacion = models.DateTimeField(default=timezone.now)
  18. tarea_titulo = models.CharField(max_length=75)
  19. tarea_descripcion = models.CharField(max_length=200)
  20. tarea_prioridad = models.IntegerField(default=0)
  21. tarea_fecha_objetivo = models.DateTimeField('Fecha objetivo',default=timezone.now)
  22. usuario = models.ForeignKey(Usuario, on_delete=models.CASCADE)
  23. def __str__(self):
  24. return self.tarea_titulo
  25.  
  26. from django.shortcuts import render
  27. from django.http import HttpResponse
  28. from .models import Tarea, Usuario
  29. # Create your views here.
  30. from django.template import loader
  31. def index(request):
  32. template = loader.get_template('Todoer/index.html')
  33. latest_question_list = Tarea.objects.all()
  34. context = {'latest_question_list': latest_question_list}
  35. return render(request, 'Todoer/index.html', context)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement