catalog list: get 'my catalogs' somewhat working

This commit is contained in:
Seth Ladygo
2019-04-24 16:27:13 -07:00
parent b8a6588f4c
commit 9d56b79684
5 changed files with 247 additions and 175 deletions

View File

@ -1,13 +1,25 @@
from django.contrib import messages
#from django.contrib import messages
from django.core import serializers
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from django.utils.translation import gettext as _
#from django.urls import reverse
#from django.utils.translation import gettext as _
from lazysignup.decorators import allow_lazy_user
#from lazysignup.decorators import allow_lazy_user
from account.decorators import login_required
from procat2.models import Catalog
@login_required
def cataloglist(request):
return render(request, 'cataloglist/cataloglist.html')
@login_required
def my_catalogs(request):
cats = Catalog.objects.filter(owner=request.user).order_by('-updated')
data = [c.summary() for c in cats]
# from time import sleep
# sleep(5)
return JsonResponse({'catalogs': data})