Sr coder
Sr coder

Reputation: 51

Django error PermissionDenied has no attribute set_cookie

In my django application i have the below code

if not exist:
   return PermissionDenied

This line will returns following error

type object 'PermissionDenied' has no attribute 'set_cookie'

Can any one help me please

Upvotes: 1

Views: 107

Answers (1)

Srishti Ahuja
Srishti Ahuja

Reputation: 191

Import this file in your file:

from django.core.exceptions import PermissionDenied

Raise Permission Denied as follows:

if not exist:
    raise PermissionDenied()

Upvotes: 1

Related Questions