We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Ordernar Propuestas
Por:
- [x] últimas creadas
- [x] Creadas por organización
- [x] Con más orazones.

Y por *defecto* puede ser:
- Random
- Por corazones, encuentro local, es organización.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `popular_proposal/filters.py`
Content:
```
1 # coding=utf-8
2 from django_filters import (FilterSet,
3                             ChoiceFilter,
4                             ModelChoiceFilter,
5                             )
6 from popular_proposal.models import PopularProposal
7 from popular_proposal.forms.form_texts import TOPIC_CHOICES
8 from elections.models import Area
9 from django.conf import settings
10 from constance import config
11 from django.forms import CharField, Form, ChoiceField
12 from haystack.query import SearchQuerySet
13 
14 
15 def filterable_areas(request):
16     if settings.FILTERABLE_AREAS_TYPE:
17         return Area.public.filter(classification__in=settings.FILTERABLE_AREAS_TYPE)
18     return Area.public.all()
19 
20 
21 class TextSearchForm(Form):
22     text = CharField(label=u'Qué buscas?', required=False)
23     order_by = ChoiceField(required=False,
24                            label=u"Ordenar por",
25                            choices=[('', u'Por apoyos'),
26                                     ('-created', u'Últimas primero'),
27                                     ])
28 
29     def full_clean(self):
30         super(TextSearchForm, self).full_clean()
31         cleaned_data = {}
32         for k in self.cleaned_data:
33             v = self.cleaned_data.get(k, '')
34 
35             if (isinstance(v, unicode) or isinstance(v, str)) and not v.strip():
36                 cleaned_data[k] = None
37         self.cleaned_data.update(cleaned_data)
38 
39 
40 class ProposalWithoutAreaFilter(FilterSet):
41     clasification = ChoiceFilter(choices=TOPIC_CHOICES,
42                                  empty_label=u"Selecciona",
43                                  label=u"Clasificación")
44 
45     def __init__(self,
46                  data=None,
47                  queryset=None,
48                  prefix=None,
49                  strict=None,
50                  **kwargs):
51         self.area = kwargs.pop('area', None)
52         if self.area is None and data is not None:
53             self.area = data.get('area', None)
54             if self.area:
55                 self.area = Area.objects.get(id=self.area)
56         if queryset is None:
57             queryset = PopularProposal.ordered.all()
58         if self.area is not None:
59             queryset = queryset.filter(area=self.area)
60         super(ProposalWithoutAreaFilter, self).__init__(data=data,
61                                                         queryset=queryset,
62                                                         prefix=prefix,
63                                                         strict=strict)
64 
65     @property
66     def form(self):
67         super(ProposalWithoutAreaFilter, self).form
68         is_filled_search = False
69         for k in self.data:
70             i = self.data[k]
71             is_filled_search = True
72             self._form.fields[k].initial = i
73         self._form.is_filled_search = is_filled_search
74         return self._form
75 
76     @property
77     def qs(self):
78 
79         super(ProposalWithoutAreaFilter, self).qs
80         self._qs = self._qs.exclude(area__id=config.HIDDEN_AREAS)
81         if not self.form.is_valid():
82             return self._qs
83         order_by = self.form.cleaned_data.get('order_by', None)
84         if order_by:
85             self._qs = self._qs.order_by(order_by)
86         else:
87             self._qs = self._qs.by_likers()
88         text = self.form.cleaned_data.get('text', '')
89 
90         if text:
91             pks = []
92             text_search = SearchQuerySet().models(self._meta.model).auto_query(text)
93             for r in text_search:
94                 pks.append(r.pk)
95             return self._qs.filter(id__in=pks)
96         return self._qs
97 
98     class Meta:
99         model = PopularProposal
100         fields = ['clasification', ]
101         form = TextSearchForm
102 
103 
104 def possible_areas(request):
105     as_ = Area.public.all()
106     return as_
107 
108 
109 class ProposalWithAreaFilter(ProposalWithoutAreaFilter):
110     area = ModelChoiceFilter(queryset=possible_areas, label="Comuna donde fue generada")
111 
112 
113 class ProposalGeneratedAtFilter(ProposalWithoutAreaFilter):
114     generated_at = ModelChoiceFilter(queryset=filterable_areas,
115                                      empty_label=u"Selecciona",
116                                      label="Comuna donde fue generada")
117
```
--- 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()

```

diff --git a/popular_proposal/filters.py b/popular_proposal/filters.py
--- a/popular_proposal/filters.py
+++ b/popular_proposal/filters.py
@@ -24,6 +24,8 @@
                            label=u"Ordenar por",
                            choices=[('', u'Por apoyos'),
                                     ('-created', u'Últimas primero'),
+                                    ('-proposer__profile__is_organization', u'De organizaciones primero'),
+                                    ('-is_local_meeting', u'Encuentros locales primero'),
                                     ])
 
     def full_clean(self):

{"golden_diff": "diff --git a/popular_proposal/filters.py b/popular_proposal/filters.py\n--- a/popular_proposal/filters.py\n+++ b/popular_proposal/filters.py\n@@ -24,6 +24,8 @@\n                            label=u\"Ordenar por\",\n                            choices=[('', u'Por apoyos'),\n                                     ('-created', u'\u00daltimas primero'),\n+                                    ('-proposer__profile__is_organization', u'De organizaciones primero'),\n+                                    ('-is_local_meeting', u'Encuentros locales primero'),\n                                     ])\n \n     def full_clean(self):\n", "issue": "Ordernar Propuestas\nPor:\r\n- [x] \u00faltimas creadas\r\n- [x] Creadas por organizaci\u00f3n\r\n- [x] Con m\u00e1s orazones.\r\n\r\nY por *defecto* puede ser:\r\n- Random\r\n- Por corazones, encuentro local, es organizaci\u00f3n.\n", "before_files": [{"content": "# coding=utf-8\nfrom django_filters import (FilterSet,\n                            ChoiceFilter,\n                            ModelChoiceFilter,\n                            )\nfrom popular_proposal.models import PopularProposal\nfrom popular_proposal.forms.form_texts import TOPIC_CHOICES\nfrom elections.models import Area\nfrom django.conf import settings\nfrom constance import config\nfrom django.forms import CharField, Form, ChoiceField\nfrom haystack.query import SearchQuerySet\n\n\ndef filterable_areas(request):\n    if settings.FILTERABLE_AREAS_TYPE:\n        return Area.public.filter(classification__in=settings.FILTERABLE_AREAS_TYPE)\n    return Area.public.all()\n\n\nclass TextSearchForm(Form):\n    text = CharField(label=u'Qu\u00e9 buscas?', required=False)\n    order_by = ChoiceField(required=False,\n                           label=u\"Ordenar por\",\n                           choices=[('', u'Por apoyos'),\n                                    ('-created', u'\u00daltimas primero'),\n                                    ])\n\n    def full_clean(self):\n        super(TextSearchForm, self).full_clean()\n        cleaned_data = {}\n        for k in self.cleaned_data:\n            v = self.cleaned_data.get(k, '')\n\n            if (isinstance(v, unicode) or isinstance(v, str)) and not v.strip():\n                cleaned_data[k] = None\n        self.cleaned_data.update(cleaned_data)\n\n\nclass ProposalWithoutAreaFilter(FilterSet):\n    clasification = ChoiceFilter(choices=TOPIC_CHOICES,\n                                 empty_label=u\"Selecciona\",\n                                 label=u\"Clasificaci\u00f3n\")\n\n    def __init__(self,\n                 data=None,\n                 queryset=None,\n                 prefix=None,\n                 strict=None,\n                 **kwargs):\n        self.area = kwargs.pop('area', None)\n        if self.area is None and data is not None:\n            self.area = data.get('area', None)\n            if self.area:\n                self.area = Area.objects.get(id=self.area)\n        if queryset is None:\n            queryset = PopularProposal.ordered.all()\n        if self.area is not None:\n            queryset = queryset.filter(area=self.area)\n        super(ProposalWithoutAreaFilter, self).__init__(data=data,\n                                                        queryset=queryset,\n                                                        prefix=prefix,\n                                                        strict=strict)\n\n    @property\n    def form(self):\n        super(ProposalWithoutAreaFilter, self).form\n        is_filled_search = False\n        for k in self.data:\n            i = self.data[k]\n            is_filled_search = True\n            self._form.fields[k].initial = i\n        self._form.is_filled_search = is_filled_search\n        return self._form\n\n    @property\n    def qs(self):\n\n        super(ProposalWithoutAreaFilter, self).qs\n        self._qs = self._qs.exclude(area__id=config.HIDDEN_AREAS)\n        if not self.form.is_valid():\n            return self._qs\n        order_by = self.form.cleaned_data.get('order_by', None)\n        if order_by:\n            self._qs = self._qs.order_by(order_by)\n        else:\n            self._qs = self._qs.by_likers()\n        text = self.form.cleaned_data.get('text', '')\n\n        if text:\n            pks = []\n            text_search = SearchQuerySet().models(self._meta.model).auto_query(text)\n            for r in text_search:\n                pks.append(r.pk)\n            return self._qs.filter(id__in=pks)\n        return self._qs\n\n    class Meta:\n        model = PopularProposal\n        fields = ['clasification', ]\n        form = TextSearchForm\n\n\ndef possible_areas(request):\n    as_ = Area.public.all()\n    return as_\n\n\nclass ProposalWithAreaFilter(ProposalWithoutAreaFilter):\n    area = ModelChoiceFilter(queryset=possible_areas, label=\"Comuna donde fue generada\")\n\n\nclass ProposalGeneratedAtFilter(ProposalWithoutAreaFilter):\n    generated_at = ModelChoiceFilter(queryset=filterable_areas,\n                                     empty_label=u\"Selecciona\",\n                                     label=\"Comuna donde fue generada\")\n", "path": "popular_proposal/filters.py"}], "after_files": [{"content": "# coding=utf-8\nfrom django_filters import (FilterSet,\n                            ChoiceFilter,\n                            ModelChoiceFilter,\n                            )\nfrom popular_proposal.models import PopularProposal\nfrom popular_proposal.forms.form_texts import TOPIC_CHOICES\nfrom elections.models import Area\nfrom django.conf import settings\nfrom constance import config\nfrom django.forms import CharField, Form, ChoiceField\nfrom haystack.query import SearchQuerySet\n\n\ndef filterable_areas(request):\n    if settings.FILTERABLE_AREAS_TYPE:\n        return Area.public.filter(classification__in=settings.FILTERABLE_AREAS_TYPE)\n    return Area.public.all()\n\n\nclass TextSearchForm(Form):\n    text = CharField(label=u'Qu\u00e9 buscas?', required=False)\n    order_by = ChoiceField(required=False,\n                           label=u\"Ordenar por\",\n                           choices=[('', u'Por apoyos'),\n                                    ('-created', u'\u00daltimas primero'),\n                                    ('-proposer__profile__is_organization', u'De organizaciones primero'),\n                                    ('-is_local_meeting', u'Encuentros locales primero'),\n                                    ])\n\n    def full_clean(self):\n        super(TextSearchForm, self).full_clean()\n        cleaned_data = {}\n        for k in self.cleaned_data:\n            v = self.cleaned_data.get(k, '')\n\n            if (isinstance(v, unicode) or isinstance(v, str)) and not v.strip():\n                cleaned_data[k] = None\n        self.cleaned_data.update(cleaned_data)\n\n\nclass ProposalWithoutAreaFilter(FilterSet):\n    clasification = ChoiceFilter(choices=TOPIC_CHOICES,\n                                 empty_label=u\"Selecciona\",\n                                 label=u\"Clasificaci\u00f3n\")\n\n    def __init__(self,\n                 data=None,\n                 queryset=None,\n                 prefix=None,\n                 strict=None,\n                 **kwargs):\n        self.area = kwargs.pop('area', None)\n        if self.area is None and data is not None:\n            self.area = data.get('area', None)\n            if self.area:\n                self.area = Area.objects.get(id=self.area)\n        if queryset is None:\n            queryset = PopularProposal.ordered.all()\n        if self.area is not None:\n            queryset = queryset.filter(area=self.area)\n        super(ProposalWithoutAreaFilter, self).__init__(data=data,\n                                                        queryset=queryset,\n                                                        prefix=prefix,\n                                                        strict=strict)\n\n    @property\n    def form(self):\n        super(ProposalWithoutAreaFilter, self).form\n        is_filled_search = False\n        for k in self.data:\n            i = self.data[k]\n            is_filled_search = True\n            self._form.fields[k].initial = i\n        self._form.is_filled_search = is_filled_search\n        return self._form\n\n    @property\n    def qs(self):\n\n        super(ProposalWithoutAreaFilter, self).qs\n        self._qs = self._qs.exclude(area__id=config.HIDDEN_AREAS)\n        if not self.form.is_valid():\n            return self._qs\n        order_by = self.form.cleaned_data.get('order_by', None)\n        if order_by:\n            self._qs = self._qs.order_by(order_by)\n        else:\n            self._qs = self._qs.by_likers()\n        text = self.form.cleaned_data.get('text', '')\n\n        if text:\n            pks = []\n            text_search = SearchQuerySet().models(self._meta.model).auto_query(text)\n            for r in text_search:\n                pks.append(r.pk)\n            return self._qs.filter(id__in=pks)\n        return self._qs\n\n    class Meta:\n        model = PopularProposal\n        fields = ['clasification', ]\n        form = TextSearchForm\n\n\ndef possible_areas(request):\n    as_ = Area.public.all()\n    return as_\n\n\nclass ProposalWithAreaFilter(ProposalWithoutAreaFilter):\n    area = ModelChoiceFilter(queryset=possible_areas, label=\"Comuna donde fue generada\")\n\n\nclass ProposalGeneratedAtFilter(ProposalWithoutAreaFilter):\n    generated_at = ModelChoiceFilter(queryset=filterable_areas,\n                                     empty_label=u\"Selecciona\",\n                                     label=\"Comuna donde fue generada\")\n", "path": "popular_proposal/filters.py"}]}