diff --git a/Admin/settings.py b/Admin/settings.py index 7278a7d..a5afc12 100644 --- a/Admin/settings.py +++ b/Admin/settings.py @@ -12,7 +12,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = 'django-insecure-5*mm&uf5zq@t6nrs_5z8-_qtyapm^3&yz^wqqkc_a!v(!ulj-^' # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False +DEBUG = True ALLOWED_HOSTS = ['*'] diff --git a/Clientes/views.py b/Clientes/views.py index baa921f..7d3a950 100644 --- a/Clientes/views.py +++ b/Clientes/views.py @@ -2,9 +2,24 @@ from django.shortcuts import render from django.http import HttpResponse from django.contrib.auth.decorators import login_required from .models import Timbres +from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger + @login_required def index(request): - return HttpResponse('hello') + timbres_list = Timbres.objects.all() + page = request.GET.get('page', 1) + paginator = Paginator(timbres_list, 1) + + try: + timbres = paginator.page(page) + except PageNotAnInteger: + timbres = paginator.page(1) + except EmptyPage: + timbres = paginator.page(paginator.num_pages) + context = { + 'timbres':timbres, + } + return render(request,'Clientes/index.html',context) def add_timbre(request): @@ -24,8 +39,6 @@ def add_timbre(request): 'tipo':tipo, 'rfcp':rfcp } - p = Timbres.objects.all() - p.delete() try: obj = Timbres.objects.create(**obj) return HttpResponse('ok') diff --git a/Templates/Clientes/index.html b/Templates/Clientes/index.html new file mode 100644 index 0000000..02be319 --- /dev/null +++ b/Templates/Clientes/index.html @@ -0,0 +1,31 @@ +{% extends "base.html" %} + + +{% block content %} +
| UUID | ++ + RFC Cliente + | +actions | +
|---|---|---|
| {{obj.uuid}} | +{{obj.rfcc}} | ++ {% if request.user.is_staff %} + View + {% endif %} + | +