prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Erreur 403 après recherche dans la bibliothèque
  > Bonjour,
  > 
  > Je tombe sur une erreur 403 "Vous n’avez pas les droits suffisants pour accéder à cette page." après une recherche dans les cours présents dans la bibliothèque.
  Voilà comment elle est apparue :
  > 
  > - Arrivé sur le site déconnecté
  > - Je suis allé dans "Développement web" depuis le bandeau en haut du site
  > - A partir de là je me suis connecté à mon compte (même onglet, bouton classique), ce qui m'a ramené sur la page
  > - Puis j'ai fait une recherche "PHP" dans la barre de rechercher, ce qui m'a amené sur [ce lien](https://zestedesavoir.com/rechercher/?q=PHP&models=content&from_library=on&category=informatique&subcategory=site-web)
  > 
  > L'erreur 403 se produit lorsque je coche 1 à 3 cases (sous la barre de recherche), pour filtrer les résultats, et que je clique à nouveau sur le bouton "rechercher" dans la barre.
  > 
  > Voilà [un exemple de lien](https://zestedesavoir.com/rechercher/?q=PHP&category=informatique&subcategory=site-web&from_library=on&models=) provoquant une erreur 403 de mon côté.
  > 
  > Bye
  
  Sujet : https://zestedesavoir.com/forums/sujet/11609/erreur-403-apres-recherche-dans-la-bibliotheque/
  *Envoyé depuis Zeste de Savoir*
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `zds/searchv2/forms.py`
  Content:
  ```
  1 import os
  2 import random
  3 
  4 from django import forms
  5 from django.conf import settings
  6 from django.utils.translation import ugettext_lazy as _
  7 
  8 from crispy_forms.bootstrap import StrictButton
  9 from crispy_forms.helper import FormHelper
  10 from crispy_forms.layout import Layout, Field
  11 from django.core.urlresolvers import reverse
  12 
  13 
  14 class SearchForm(forms.Form):
  15     q = forms.CharField(
  16         label=_('Recherche'),
  17         max_length=150,
  18         required=False,
  19         widget=forms.TextInput(
  20             attrs={
  21                 'type': 'search',
  22                 'required': 'required'
  23             }
  24         )
  25     )
  26 
  27     choices = sorted(
  28         [(k, v[0]) for k, v in settings.ZDS_APP['search']['search_groups'].items()],
  29         key=lambda pair: pair[1]
  30     )
  31 
  32     models = forms.MultipleChoiceField(
  33         label='',
  34         widget=forms.CheckboxSelectMultiple,
  35         required=False,
  36         choices=choices
  37     )
  38 
  39     category = forms.CharField(widget=forms.HiddenInput, required=False)
  40     subcategory = forms.CharField(widget=forms.HiddenInput, required=False)
  41     from_library = forms.CharField(widget=forms.HiddenInput, required=False)
  42 
  43     def __init__(self, *args, **kwargs):
  44 
  45         super(SearchForm, self).__init__(*args, **kwargs)
  46 
  47         self.helper = FormHelper()
  48         self.helper.form_id = 'search-form'
  49         self.helper.form_class = 'clearfix'
  50         self.helper.form_method = 'get'
  51         self.helper.form_action = reverse('search:query')
  52 
  53         try:
  54             with open(os.path.join(settings.BASE_DIR, 'suggestions.txt'), 'r') as suggestions_file:
  55                 suggestions = ', '.join(random.sample(suggestions_file.readlines(), 5)) + '…'
  56         except OSError:
  57             suggestions = _('Mathématiques, Droit, UDK, Langues, Python…')
  58 
  59         self.fields['q'].widget.attrs['placeholder'] = suggestions
  60 
  61         self.helper.layout = Layout(
  62             Field('q'),
  63             StrictButton('', type='submit', css_class='ico-after ico-search', title=_('Rechercher')),
  64             Field('category'),
  65             Field('subcategory'),
  66             Field('from_library')
  67         )
  68
  ```
  --- 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/zds/searchv2/forms.py b/zds/searchv2/forms.py
  --- a/zds/searchv2/forms.py
  +++ b/zds/searchv2/forms.py
  @@ -31,7 +31,12 @@
   
       models = forms.MultipleChoiceField(
           label='',
  -        widget=forms.CheckboxSelectMultiple,
  +        widget=forms.CheckboxSelectMultiple(
  +            attrs={
  +                'class': 'search-filters',
  +                'form': 'search-form'
  +            }
  +        ),
           required=False,
           choices=choices
       )
  
verification_info: {"golden_diff": "diff --git a/zds/searchv2/forms.py b/zds/searchv2/forms.py\n--- a/zds/searchv2/forms.py\n+++ b/zds/searchv2/forms.py\n@@ -31,7 +31,12 @@\n \n     models = forms.MultipleChoiceField(\n         label='',\n-        widget=forms.CheckboxSelectMultiple,\n+        widget=forms.CheckboxSelectMultiple(\n+            attrs={\n+                'class': 'search-filters',\n+                'form': 'search-form'\n+            }\n+        ),\n         required=False,\n         choices=choices\n     )\n", "issue": "Erreur 403 apr\u00e8s recherche dans la biblioth\u00e8que\n> Bonjour,\r\n> \r\n> Je tombe sur une erreur 403 \"Vous n\u2019avez pas les droits suffisants pour acc\u00e9der \u00e0 cette page.\" apr\u00e8s une recherche dans les cours pr\u00e9sents dans la biblioth\u00e8que.\r\nVoil\u00e0 comment elle est apparue :\r\n> \r\n> - Arriv\u00e9 sur le site d\u00e9connect\u00e9\r\n> - Je suis all\u00e9 dans \"D\u00e9veloppement web\" depuis le bandeau en haut du site\r\n> - A partir de l\u00e0 je me suis connect\u00e9 \u00e0 mon compte (m\u00eame onglet, bouton classique), ce qui m'a ramen\u00e9 sur la page\r\n> - Puis j'ai fait une recherche \"PHP\" dans la barre de rechercher, ce qui m'a amen\u00e9 sur [ce lien](https://zestedesavoir.com/rechercher/?q=PHP&models=content&from_library=on&category=informatique&subcategory=site-web)\r\n> \r\n> L'erreur 403 se produit lorsque je coche 1 \u00e0 3 cases (sous la barre de recherche), pour filtrer les r\u00e9sultats, et que je clique \u00e0 nouveau sur le bouton \"rechercher\" dans la barre.\r\n> \r\n> Voil\u00e0 [un exemple de lien](https://zestedesavoir.com/rechercher/?q=PHP&category=informatique&subcategory=site-web&from_library=on&models=) provoquant une erreur 403 de mon c\u00f4t\u00e9.\r\n> \r\n> Bye\r\n\r\nSujet : https://zestedesavoir.com/forums/sujet/11609/erreur-403-apres-recherche-dans-la-bibliotheque/\r\n*Envoy\u00e9 depuis Zeste de Savoir*\n", "before_files": [{"content": "import os\nimport random\n\nfrom django import forms\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom crispy_forms.bootstrap import StrictButton\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import Layout, Field\nfrom django.core.urlresolvers import reverse\n\n\nclass SearchForm(forms.Form):\n    q = forms.CharField(\n        label=_('Recherche'),\n        max_length=150,\n        required=False,\n        widget=forms.TextInput(\n            attrs={\n                'type': 'search',\n                'required': 'required'\n            }\n        )\n    )\n\n    choices = sorted(\n        [(k, v[0]) for k, v in settings.ZDS_APP['search']['search_groups'].items()],\n        key=lambda pair: pair[1]\n    )\n\n    models = forms.MultipleChoiceField(\n        label='',\n        widget=forms.CheckboxSelectMultiple,\n        required=False,\n        choices=choices\n    )\n\n    category = forms.CharField(widget=forms.HiddenInput, required=False)\n    subcategory = forms.CharField(widget=forms.HiddenInput, required=False)\n    from_library = forms.CharField(widget=forms.HiddenInput, required=False)\n\n    def __init__(self, *args, **kwargs):\n\n        super(SearchForm, self).__init__(*args, **kwargs)\n\n        self.helper = FormHelper()\n        self.helper.form_id = 'search-form'\n        self.helper.form_class = 'clearfix'\n        self.helper.form_method = 'get'\n        self.helper.form_action = reverse('search:query')\n\n        try:\n            with open(os.path.join(settings.BASE_DIR, 'suggestions.txt'), 'r') as suggestions_file:\n                suggestions = ', '.join(random.sample(suggestions_file.readlines(), 5)) + '\u2026'\n        except OSError:\n            suggestions = _('Math\u00e9matiques, Droit, UDK, Langues, Python\u2026')\n\n        self.fields['q'].widget.attrs['placeholder'] = suggestions\n\n        self.helper.layout = Layout(\n            Field('q'),\n            StrictButton('', type='submit', css_class='ico-after ico-search', title=_('Rechercher')),\n            Field('category'),\n            Field('subcategory'),\n            Field('from_library')\n        )\n", "path": "zds/searchv2/forms.py"}], "after_files": [{"content": "import os\nimport random\n\nfrom django import forms\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom crispy_forms.bootstrap import StrictButton\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import Layout, Field\nfrom django.core.urlresolvers import reverse\n\n\nclass SearchForm(forms.Form):\n    q = forms.CharField(\n        label=_('Recherche'),\n        max_length=150,\n        required=False,\n        widget=forms.TextInput(\n            attrs={\n                'type': 'search',\n                'required': 'required'\n            }\n        )\n    )\n\n    choices = sorted(\n        [(k, v[0]) for k, v in settings.ZDS_APP['search']['search_groups'].items()],\n        key=lambda pair: pair[1]\n    )\n\n    models = forms.MultipleChoiceField(\n        label='',\n        widget=forms.CheckboxSelectMultiple(\n            attrs={\n                'class': 'search-filters',\n                'form': 'search-form'\n            }\n        ),\n        required=False,\n        choices=choices\n    )\n\n    category = forms.CharField(widget=forms.HiddenInput, required=False)\n    subcategory = forms.CharField(widget=forms.HiddenInput, required=False)\n    from_library = forms.CharField(widget=forms.HiddenInput, required=False)\n\n    def __init__(self, *args, **kwargs):\n\n        super(SearchForm, self).__init__(*args, **kwargs)\n\n        self.helper = FormHelper()\n        self.helper.form_id = 'search-form'\n        self.helper.form_class = 'clearfix'\n        self.helper.form_method = 'get'\n        self.helper.form_action = reverse('search:query')\n\n        try:\n            with open(os.path.join(settings.BASE_DIR, 'suggestions.txt'), 'r') as suggestions_file:\n                suggestions = ', '.join(random.sample(suggestions_file.readlines(), 5)) + '\u2026'\n        except OSError:\n            suggestions = _('Math\u00e9matiques, Droit, UDK, Langues, Python\u2026')\n\n        self.fields['q'].widget.attrs['placeholder'] = suggestions\n\n        self.helper.layout = Layout(\n            Field('q'),\n            StrictButton('', type='submit', css_class='ico-after ico-search', title=_('Rechercher')),\n            Field('category'),\n            Field('subcategory'),\n            Field('from_library')\n        )\n", "path": "zds/searchv2/forms.py"}]}