Models:
INTERNAL_STATES = (
('1', _('Live')),
('2', _('Coming soon')),
('3', _('Draft')),
)
View:
if request.user.is_staff is False and building.internal_state is not 1:
raise Http404
else:
pass
Can someone tell me why this code is landing me a 404 even if the building I am trying to view has internal_state = 1 when I am not logged in? Sorry for posting such an easy question but I just can’t see what’s wrong with it.
The type of internal_state is a string, not an integer.
Try this: