from django.views.generic import TemplateView

from competition.models import Competition


class HomePageView(TemplateView):
    template_name = "home/home.html"
    
    def get_context_data(self, **kwargs):
      context = super(HomePageView, self).get_context_data(**kwargs)
      my_competitions = Competition.objects.user_registered(self.request.user)
      context["registered_competitions"] = my_competitions.exclude(is_running=False, is_open=False)
      context["closed_competitions"] = my_competitions.filter(is_running=False, is_open=False)
      return context


@@ -205,24 +205,26 @@
 rgs):%0A      
+  
 context = su
@@ -274,16 +274,72 @@
 kwargs)%0A
+%0A        if not self.request.user.is_anonymous():%0A      
       my
@@ -407,32 +407,38 @@
 est.user)%0A      
+     
+ 
 context%5B%22registe
@@ -511,24 +511,30 @@
 open=False)%0A
+      
       contex
@@ -612,24 +612,26 @@
 open=False)%0A
+  
       return

Check if user is not anonymous on homepage