Exemple #1
0
def renderEditResourceList(request, username, listId):
    if request.user.username == username:
        if request.method == "POST":
            updateResourceList(request)
            jsonResult = {"message": "OK"}
            return JsonResponse(jsonResult)
        else:
            returns = {}
            resourceList = get_object_or_404(ResourceList, id=listId)
            returns["resourceList"] = resourceList

            # jsonResourceList, jsonResources, jsonCategories
            returns["jsonResourceList"] = serialize(
                'json', [resourceList], use_natural_foreign_keys=True)
            returns["jsonResources"] = serialize(
                'json',
                Resource.objects.filter(
                    resourceList=resourceList).order_by('position'),
                use_natural_foreign_keys=True)
            returns["jsonCategories"] = Category.getCategoryTreeJSON(Category)

            return render(request, 'user/editList.html', returns)
    else:
        return redirect('renderIndex')
Exemple #2
0
def renderAdminSettings(request):
    returns = {"jsonCategories": Category.getCategoryTreeJSON(Category)}
    return render(request, 'adminSettings.html', returns)