def dispatch(self, request, *args, **kwargs):
self.request = request<EOL>in_group = False<EOL>required_group = self.get_group_required()<EOL>if not required_group or required_group == ['<STR_LIT>']:<EOL><INDENT>in_group = True<EOL><DEDENT>elif self.request.user.is_authenticated():<EOL><INDENT>in_group = self.check_membership(required_group)<EOL><DEDENT>if not in_group:<EOL><INDENT>if self.raise_exception:<EOL><INDENT>raise PermissionDenied<EOL><DEDENT>else:<EOL><INDENT>return redirect_to_login(<EOL>request.get_full_path(),<EOL>self.get_login_url(),<EOL>self.get_redirect_field_name())<EOL><DEDENT><DEDENT>return super(GroupRequiredMixin, self).dispatch(<EOL>request, *args, **kwargs)<EOL>
This override of dispatch ensures that if no group is required, then
the request still goes through without being logged in.