prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Pages lentes
  Certaines pages sont un peu lentes à charger:
  - liste des clubs
  
  C'est peut-être lié au grand nombre d'images, il faudrait étudier la possibilité de cacher ces images.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `server/apps/club/views.py`
  Content:
  ```
  1 from django.views.generic import ListView, TemplateView
  2 from django.contrib.auth.mixins import LoginRequiredMixin
  3 from django.urls import resolve
  4 
  5 from apps.club.models import Club, BDX
  6 from apps.group.models import Group
  7 from apps.group.views import BaseDetailGroupView
  8 
  9 from apps.utils.slug import *
  10 
  11 class ListClubView(TemplateView):
  12     template_name = 'club/list.html'
  13 
  14     def get_context_data(self, **kwargs):
  15         context = {'club_list': [] }
  16         try:
  17             context['club_list'].append({
  18                 'grouper': "Mes Clubs et Assos",
  19                 'list': Club.objects.filter(members__user=self.request.user).only('name', 'slug', 'logo', 'bdx_type'),
  20             })
  21         except Exception:
  22             pass
  23         club_list = Club.objects.all().select_related('bdx_type').only('name', 'slug', 'logo', 'bdx_type')
  24         context['club_list'].append({
  25             'grouper': "Associations",
  26             'list': club_list.filter(bdx_type__isnull=True)
  27         })
  28         for bdx in BDX.objects.all():
  29             context['club_list'].append({
  30                 'grouper': f'Clubs {bdx.name}',
  31                 'list': club_list.filter(bdx_type=bdx),
  32             })
  33         return context
  34 
  35 
  36 
  37 class DetailClubView(BaseDetailGroupView):
  38     '''Vue de détails d'un club.'''
  39     
  40     template_name='club/detail.html'
  41 
  42 
  43 class DetailGroupMembersView(LoginRequiredMixin, ListView):
  44     template_name = 'club/members.html'
  45     
  46     def get_object(self, **kwargs):
  47         app = resolve(self.request.path).app_name
  48         slug = self.kwargs.get("slug")
  49         return get_object_from_slug(app, slug)
  50     
  51     def get_queryset(self, **kwargs):
  52         object = self.get_object()
  53         members = object.members.through.objects.filter(group=object)
  54         return members.order_by('year', 'order')
  55     
  56     def get_context_data(self, **kwargs):
  57         context = super().get_context_data(**kwargs)
  58         context['object'] = self.get_object()
  59         return context
  60
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/server/apps/club/views.py b/server/apps/club/views.py
  --- a/server/apps/club/views.py
  +++ b/server/apps/club/views.py
  @@ -2,8 +2,7 @@
   from django.contrib.auth.mixins import LoginRequiredMixin
   from django.urls import resolve
   
  -from apps.club.models import Club, BDX
  -from apps.group.models import Group
  +from apps.club.models import Club
   from apps.group.views import BaseDetailGroupView
   
   from apps.utils.slug import *
  @@ -12,24 +11,18 @@
       template_name = 'club/list.html'
   
       def get_context_data(self, **kwargs):
  -        context = {'club_list': [] }
  -        try:
  -            context['club_list'].append({
  -                'grouper': "Mes Clubs et Assos",
  -                'list': Club.objects.filter(members__user=self.request.user).only('name', 'slug', 'logo', 'bdx_type'),
  -            })
  -        except Exception:
  -            pass
  -        club_list = Club.objects.all().select_related('bdx_type').only('name', 'slug', 'logo', 'bdx_type')
  -        context['club_list'].append({
  -            'grouper': "Associations",
  -            'list': club_list.filter(bdx_type__isnull=True)
  -        })
  -        for bdx in BDX.objects.all():
  -            context['club_list'].append({
  -                'grouper': f'Clubs {bdx.name}',
  -                'list': club_list.filter(bdx_type=bdx),
  -            })
  +        context = {'club_list': {} }
  +        clubList = {}
  +        allMembersClub = Club.objects.filter(members__user=self.request.user).only('name', 'slug', 'logo', 'bdx_type')
  +        for club in allMembersClub:
  +          clubList.setdefault("Mes Clubs et Assos", []).append(club)
  +        allClubs = Club.objects.all().select_related("bdx_type").only('name', 'slug', 'logo', 'bdx_type')
  +        for club in allClubs:
  +          if(club.bdx_type is None):
  +            clubList.setdefault("Associations", []).append(club)
  +          else:
  +            clubList.setdefault(f'Clubs {club.bdx_type.name}', []).append(club)
  +        context['club_list']=clubList
           return context
  
verification_info: {"golden_diff": "diff --git a/server/apps/club/views.py b/server/apps/club/views.py\n--- a/server/apps/club/views.py\n+++ b/server/apps/club/views.py\n@@ -2,8 +2,7 @@\n from django.contrib.auth.mixins import LoginRequiredMixin\n from django.urls import resolve\n \n-from apps.club.models import Club, BDX\n-from apps.group.models import Group\n+from apps.club.models import Club\n from apps.group.views import BaseDetailGroupView\n \n from apps.utils.slug import *\n@@ -12,24 +11,18 @@\n     template_name = 'club/list.html'\n \n     def get_context_data(self, **kwargs):\n-        context = {'club_list': [] }\n-        try:\n-            context['club_list'].append({\n-                'grouper': \"Mes Clubs et Assos\",\n-                'list': Club.objects.filter(members__user=self.request.user).only('name', 'slug', 'logo', 'bdx_type'),\n-            })\n-        except Exception:\n-            pass\n-        club_list = Club.objects.all().select_related('bdx_type').only('name', 'slug', 'logo', 'bdx_type')\n-        context['club_list'].append({\n-            'grouper': \"Associations\",\n-            'list': club_list.filter(bdx_type__isnull=True)\n-        })\n-        for bdx in BDX.objects.all():\n-            context['club_list'].append({\n-                'grouper': f'Clubs {bdx.name}',\n-                'list': club_list.filter(bdx_type=bdx),\n-            })\n+        context = {'club_list': {} }\n+        clubList = {}\n+        allMembersClub = Club.objects.filter(members__user=self.request.user).only('name', 'slug', 'logo', 'bdx_type')\n+        for club in allMembersClub:\n+          clubList.setdefault(\"Mes Clubs et Assos\", []).append(club)\n+        allClubs = Club.objects.all().select_related(\"bdx_type\").only('name', 'slug', 'logo', 'bdx_type')\n+        for club in allClubs:\n+          if(club.bdx_type is None):\n+            clubList.setdefault(\"Associations\", []).append(club)\n+          else:\n+            clubList.setdefault(f'Clubs {club.bdx_type.name}', []).append(club)\n+        context['club_list']=clubList\n         return context\n", "issue": "Pages lentes\nCertaines pages sont un peu lentes \u00e0 charger:\r\n- liste des clubs\r\n\r\nC'est peut-\u00eatre li\u00e9 au grand nombre d'images, il faudrait \u00e9tudier la possibilit\u00e9 de cacher ces images.\n", "before_files": [{"content": "from django.views.generic import ListView, TemplateView\nfrom django.contrib.auth.mixins import LoginRequiredMixin\nfrom django.urls import resolve\n\nfrom apps.club.models import Club, BDX\nfrom apps.group.models import Group\nfrom apps.group.views import BaseDetailGroupView\n\nfrom apps.utils.slug import *\n\nclass ListClubView(TemplateView):\n    template_name = 'club/list.html'\n\n    def get_context_data(self, **kwargs):\n        context = {'club_list': [] }\n        try:\n            context['club_list'].append({\n                'grouper': \"Mes Clubs et Assos\",\n                'list': Club.objects.filter(members__user=self.request.user).only('name', 'slug', 'logo', 'bdx_type'),\n            })\n        except Exception:\n            pass\n        club_list = Club.objects.all().select_related('bdx_type').only('name', 'slug', 'logo', 'bdx_type')\n        context['club_list'].append({\n            'grouper': \"Associations\",\n            'list': club_list.filter(bdx_type__isnull=True)\n        })\n        for bdx in BDX.objects.all():\n            context['club_list'].append({\n                'grouper': f'Clubs {bdx.name}',\n                'list': club_list.filter(bdx_type=bdx),\n            })\n        return context\n\n\n\nclass DetailClubView(BaseDetailGroupView):\n    '''Vue de d\u00e9tails d'un club.'''\n    \n    template_name='club/detail.html'\n\n\nclass DetailGroupMembersView(LoginRequiredMixin, ListView):\n    template_name = 'club/members.html'\n    \n    def get_object(self, **kwargs):\n        app = resolve(self.request.path).app_name\n        slug = self.kwargs.get(\"slug\")\n        return get_object_from_slug(app, slug)\n    \n    def get_queryset(self, **kwargs):\n        object = self.get_object()\n        members = object.members.through.objects.filter(group=object)\n        return members.order_by('year', 'order')\n    \n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['object'] = self.get_object()\n        return context\n", "path": "server/apps/club/views.py"}], "after_files": [{"content": "from django.views.generic import ListView, TemplateView\nfrom django.contrib.auth.mixins import LoginRequiredMixin\nfrom django.urls import resolve\n\nfrom apps.club.models import Club\nfrom apps.group.views import BaseDetailGroupView\n\nfrom apps.utils.slug import *\n\nclass ListClubView(TemplateView):\n    template_name = 'club/list.html'\n\n    def get_context_data(self, **kwargs):\n        context = {'club_list': {} }\n        clubList = {}\n        allMembersClub = Club.objects.filter(members__user=self.request.user).only('name', 'slug', 'logo', 'bdx_type')\n        for club in allMembersClub:\n          clubList.setdefault(\"Mes Clubs et Assos\", []).append(club)\n        allClubs = Club.objects.all().select_related(\"bdx_type\").only('name', 'slug', 'logo', 'bdx_type')\n        for club in allClubs:\n          if(club.bdx_type is None):\n            clubList.setdefault(\"Associations\", []).append(club)\n          else:\n            clubList.setdefault(f'Clubs {club.bdx_type.name}', []).append(club)\n        context['club_list']=clubList\n        return context\n\n\n\nclass DetailClubView(BaseDetailGroupView):\n    '''Vue de d\u00e9tails d'un club.'''\n    \n    template_name='club/detail.html'\n\n\nclass DetailGroupMembersView(LoginRequiredMixin, ListView):\n    template_name = 'club/members.html'\n    \n    def get_object(self, **kwargs):\n        app = resolve(self.request.path).app_name\n        slug = self.kwargs.get(\"slug\")\n        return get_object_from_slug(app, slug)\n    \n    def get_queryset(self, **kwargs):\n        object = self.get_object()\n        members = object.members.through.objects.filter(group=object)\n        return members.order_by('year', 'order')\n    \n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        context['object'] = self.get_object()\n        return context\n", "path": "server/apps/club/views.py"}]}