title: Django: ERR_TOO_MANY_REDIRECTS
body: <p>I keep getting this error on my code when the user needs to be redirected to the <code>ProfileCreateFormView</code> so they can fill out the form. I tried several browsers and even incognito mode but still the same.</p>
  
  <blockquote>
    <p>This page isn’t working
    127.0.0.1 redirected you too many times.
    Try clearing your cookies.
    ERR_TOO_MANY_REDIRECTS</p>
  </blockquote>
  
  <p>I'm using Django 2.1 and python 3.7</p>
  
  <pre><code>class LoginFormView(auth_views.LoginView):
  
      template_name = 'users/login.html'
  
      def get_success_url(self):
          url = reverse_lazy(
              'users:profile', kwargs={'pk': self.request.user.id})
          return url
  
  class ProfileDetailView(LoginRequiredMixin, DetailView):
  
      template_name = 'users/profile.html'
  
      def get_queryset(self):
          qs = models.Profile.objects.all()
          return qs
  
      def dispatch(self, request, *args, **kwargs):
          try:
              self.object = self.request.user.profiles
          except ObjectDoesNotExist:
              return redirect(reverse_lazy('users:create_profile'))
          return super().dispatch(request, *args, **kwargs)
  
  
  class ProfileCreateFormView(LoginRequiredMixin, FormView):
  
      template_name = 'users/create_profile.html'
      form_class = forms.ProfileForm
  </code></pre>
  
  <hr>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>app_name = 'users'
  
  urlpatterns = [
      path('profile/&lt;pk&gt;/', views.ProfileDetailView.as_view(), name='profile'),
      path('profile/create-profile/', views.ProfileCreateFormView.as_view(), name='create_profile'),
  ]
  </code></pre>