from django.shortcuts import render from django.http.response import HttpResponseNotAllowed from django.contrib.auth.decorators import permission_required from django.http import HttpResponse from .models import File def create_user(request): special_user = request.user if special_user.has_perm('abac.can_create_users'): pass #TODO: Create new User else: # Return a response indicating insufficient permissions return HttpResponseNotAllowed(request) @permission_required('abac.can_create_users', raise_exception=True) def create_user_view(request): # Your view logic here return HttpResponse('New user created') def landing_page(request): files = File.objects.all() return render(request, 'landing_page.html', {'files': files})