Example #1
0
 def gen_ctx(self):
     return {
         'can_view':
         app_settings.EXPLORER_PERMISSION_VIEW(self.request.user),
         'can_change':
         app_settings.EXPLORER_PERMISSION_CHANGE(self.request.user)
     }
Example #2
0
    def post(self, request, query_id):
        if not app_settings.EXPLORER_PERMISSION_CHANGE(request.user):
            return HttpResponseRedirect(
                reverse_lazy('query_detail', kwargs={'query_id': query_id})
            )

        query, form = QueryView.get_instance_and_form(request, query_id)
        success = form.is_valid() and form.save()
        vm = query_viewmodel(request, query, form=form, message="Query saved." if success else None)
        return self.render_template('explorer/query.html', vm)
 def gen_ctx(self):
     return {
         'can_view': app_settings.EXPLORER_PERMISSION_VIEW(
             self.request
         ),
         'can_change': app_settings.EXPLORER_PERMISSION_CHANGE(
             self.request
         ),
         'csrf_cookie_name': settings.CSRF_COOKIE_NAME,
     }
Example #4
0
 def wrap(request, *args, **kwargs):
     if not app_settings.EXPLORER_PERMISSION_CHANGE(request.user):
         return safe_admin_login_prompt(request)
     return f(request, *args, **kwargs)
Example #5
0
def get_app_permissions(request):
    return {
        'can_view': app_settings.EXPLORER_PERMISSION_VIEW(request.user),
        'can_change': app_settings.EXPLORER_PERMISSION_CHANGE(request.user)
    }
Example #6
0
def change_permission(request, *args, **kwargs):
    return app_settings.EXPLORER_PERMISSION_CHANGE(request.user)