Try 

`if not user.groups.filter(name='Rep').exists(): raise Http404`

to avoid having lots of lines in nested logic