prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  testing 5024: order of filter 
  **URL:** https://meinberlin-dev.liqd.net/projekte/burgerhaushalt-spandau/?mode=list
  **user:** any
  **expected behaviour:** 
  **behaviour:** 
  **important screensize:**
  **device & browser:** 
  **Comment/Question:** the order of the filter was 1) category 2) archive. It should stay this way but as we will touch the filter again later we can also do it then but need to remember. So if easy maybe change now?
  
  Screenshot?
  <img width="490" alt="Bildschirmfoto 2021-12-21 um 16 25 15" src="https://user-images.githubusercontent.com/35491681/146955180-11799600-c739-4d17-8f84-7581b57a861b.png">
  
  
  
  </issue>
  <code>
  [start of meinberlin/apps/budgeting/api.py]
  1 from django.utils.translation import get_language
  2 from django.utils.translation import gettext_lazy as _
  3 from django_filters.rest_framework import DjangoFilterBackend
  4 from rest_framework import mixins
  5 from rest_framework import viewsets
  6 from rest_framework.filters import OrderingFilter
  7 from rest_framework.pagination import PageNumberPagination
  8 
  9 from adhocracy4.api.mixins import ModuleMixin
  10 from adhocracy4.api.permissions import ViewSetRulesPermission
  11 from adhocracy4.categories import get_category_icon_url
  12 from adhocracy4.categories import has_icons
  13 from adhocracy4.categories.models import Category
  14 from meinberlin.apps.contrib.filters import IdeaCategoryFilterBackend
  15 from meinberlin.apps.votes.api import VotingTokenInfoMixin
  16 
  17 from .models import Proposal
  18 from .serializers import ProposalSerializer
  19 
  20 
  21 # To be changed to a more general IdeaPagination, when using
  22 # pagination via rest api for more idea lists
  23 class ProposalPagination(PageNumberPagination):
  24     page_size = 15
  25 
  26     def get_paginated_response(self, data):
  27         response = super(ProposalPagination, self).get_paginated_response(data)
  28         response.data['page_size'] = self.page_size
  29         response.data['page_count'] = self.page.paginator.num_pages
  30         return response
  31 
  32 
  33 class LocaleInfoMixin:
  34     def list(self, request, *args, **kwargs):
  35         response = super().list(request, args, kwargs)
  36         response.data['locale'] = get_language()
  37         return response
  38 
  39 
  40 class ProposalFilterInfoMixin(ModuleMixin):
  41     def list(self, request, *args, **kwargs):
  42         """Add the filter information to the data of the Proposal API.
  43 
  44         Needs to be used with rest_framework.mixins.ListModelMixin
  45         """
  46         filters = {}
  47 
  48         ordering_choices = [('-created', _('Most recent')), ]
  49         if self.module.has_feature('rate', Proposal):
  50             ordering_choices += ('-positive_rating_count', _('Most popular')),
  51         ordering_choices += ('-comment_count', _('Most commented')),
  52 
  53         filters['ordering'] = {
  54             'label': _('Ordering'),
  55             'choices': ordering_choices,
  56             'default': '-created',
  57         }
  58 
  59         filters['is_archived'] = {
  60             'label': _('Archived'),
  61             'choices': [
  62                 ('', _('All')),
  63                 ('false', _('No')),
  64                 ('true', _('Yes')),
  65             ],
  66             'default': 'false',
  67         }
  68 
  69         categories = Category.objects.filter(
  70             module=self.module
  71         )
  72         if categories:
  73             category_choices = [('', _('All')), ]
  74             if has_icons(self.module):
  75                 category_icons = []
  76             for category in categories:
  77                 category_choices += (str(category.pk), category.name),
  78                 if has_icons(self.module):
  79                     icon_name = getattr(category, 'icon', None)
  80                     icon_url = get_category_icon_url(icon_name)
  81                     category_icons += (str(category.pk), icon_url),
  82 
  83             filters['category'] = {
  84                 'label': _('Category'),
  85                 'choices': category_choices,
  86             }
  87             if has_icons(self.module):
  88                 filters['category']['icons'] = category_icons
  89 
  90         response = super().list(request, args, kwargs)
  91         response.data['filters'] = filters
  92         return response
  93 
  94 
  95 class ProposalViewSet(ProposalFilterInfoMixin,
  96                       LocaleInfoMixin,
  97                       VotingTokenInfoMixin,
  98                       mixins.ListModelMixin,
  99                       viewsets.GenericViewSet,
  100                       ):
  101 
  102     pagination_class = ProposalPagination
  103     serializer_class = ProposalSerializer
  104     permission_classes = (ViewSetRulesPermission,)
  105     filter_backends = (DjangoFilterBackend,
  106                        OrderingFilter,
  107                        IdeaCategoryFilterBackend,)
  108     filter_fields = ('is_archived', 'category',)
  109     ordering_fields = ('created',
  110                        'comment_count',
  111                        'positive_rating_count',)
  112 
  113     def get_permission_object(self):
  114         return self.module
  115 
  116     def get_queryset(self):
  117         proposals = Proposal.objects\
  118             .filter(module=self.module) \
  119             .annotate_comment_count() \
  120             .annotate_positive_rating_count() \
  121             .annotate_negative_rating_count() \
  122             .order_by('-created')
  123         return proposals
  124
  [end of meinberlin/apps/budgeting/api.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/meinberlin/apps/budgeting/api.py b/meinberlin/apps/budgeting/api.py
  --- a/meinberlin/apps/budgeting/api.py
  +++ b/meinberlin/apps/budgeting/api.py
  @@ -56,16 +56,6 @@
               'default': '-created',
           }
   
  -        filters['is_archived'] = {
  -            'label': _('Archived'),
  -            'choices': [
  -                ('', _('All')),
  -                ('false', _('No')),
  -                ('true', _('Yes')),
  -            ],
  -            'default': 'false',
  -        }
  -
           categories = Category.objects.filter(
               module=self.module
           )
  @@ -87,6 +77,16 @@
               if has_icons(self.module):
                   filters['category']['icons'] = category_icons
   
  +        filters['is_archived'] = {
  +            'label': _('Archived'),
  +            'choices': [
  +                ('', _('All')),
  +                ('false', _('No')),
  +                ('true', _('Yes')),
  +            ],
  +            'default': 'false',
  +        }
  +
           response = super().list(request, args, kwargs)
           response.data['filters'] = filters
           return response
  
verification_info: {"golden_diff": "diff --git a/meinberlin/apps/budgeting/api.py b/meinberlin/apps/budgeting/api.py\n--- a/meinberlin/apps/budgeting/api.py\n+++ b/meinberlin/apps/budgeting/api.py\n@@ -56,16 +56,6 @@\n             'default': '-created',\n         }\n \n-        filters['is_archived'] = {\n-            'label': _('Archived'),\n-            'choices': [\n-                ('', _('All')),\n-                ('false', _('No')),\n-                ('true', _('Yes')),\n-            ],\n-            'default': 'false',\n-        }\n-\n         categories = Category.objects.filter(\n             module=self.module\n         )\n@@ -87,6 +77,16 @@\n             if has_icons(self.module):\n                 filters['category']['icons'] = category_icons\n \n+        filters['is_archived'] = {\n+            'label': _('Archived'),\n+            'choices': [\n+                ('', _('All')),\n+                ('false', _('No')),\n+                ('true', _('Yes')),\n+            ],\n+            'default': 'false',\n+        }\n+\n         response = super().list(request, args, kwargs)\n         response.data['filters'] = filters\n         return response\n", "issue": "testing 5024: order of filter \n**URL:** https://meinberlin-dev.liqd.net/projekte/burgerhaushalt-spandau/?mode=list\r\n**user:** any\r\n**expected behaviour:** \r\n**behaviour:** \r\n**important screensize:**\r\n**device & browser:** \r\n**Comment/Question:** the order of the filter was 1) category 2) archive. It should stay this way but as we will touch the filter again later we can also do it then but need to remember. So if easy maybe change now?\r\n\r\nScreenshot?\r\n<img width=\"490\" alt=\"Bildschirmfoto 2021-12-21 um 16 25 15\" src=\"https://user-images.githubusercontent.com/35491681/146955180-11799600-c739-4d17-8f84-7581b57a861b.png\">\r\n\r\n\n", "before_files": [{"content": "from django.utils.translation import get_language\nfrom django.utils.translation import gettext_lazy as _\nfrom django_filters.rest_framework import DjangoFilterBackend\nfrom rest_framework import mixins\nfrom rest_framework import viewsets\nfrom rest_framework.filters import OrderingFilter\nfrom rest_framework.pagination import PageNumberPagination\n\nfrom adhocracy4.api.mixins import ModuleMixin\nfrom adhocracy4.api.permissions import ViewSetRulesPermission\nfrom adhocracy4.categories import get_category_icon_url\nfrom adhocracy4.categories import has_icons\nfrom adhocracy4.categories.models import Category\nfrom meinberlin.apps.contrib.filters import IdeaCategoryFilterBackend\nfrom meinberlin.apps.votes.api import VotingTokenInfoMixin\n\nfrom .models import Proposal\nfrom .serializers import ProposalSerializer\n\n\n# To be changed to a more general IdeaPagination, when using\n# pagination via rest api for more idea lists\nclass ProposalPagination(PageNumberPagination):\n    page_size = 15\n\n    def get_paginated_response(self, data):\n        response = super(ProposalPagination, self).get_paginated_response(data)\n        response.data['page_size'] = self.page_size\n        response.data['page_count'] = self.page.paginator.num_pages\n        return response\n\n\nclass LocaleInfoMixin:\n    def list(self, request, *args, **kwargs):\n        response = super().list(request, args, kwargs)\n        response.data['locale'] = get_language()\n        return response\n\n\nclass ProposalFilterInfoMixin(ModuleMixin):\n    def list(self, request, *args, **kwargs):\n        \"\"\"Add the filter information to the data of the Proposal API.\n\n        Needs to be used with rest_framework.mixins.ListModelMixin\n        \"\"\"\n        filters = {}\n\n        ordering_choices = [('-created', _('Most recent')), ]\n        if self.module.has_feature('rate', Proposal):\n            ordering_choices += ('-positive_rating_count', _('Most popular')),\n        ordering_choices += ('-comment_count', _('Most commented')),\n\n        filters['ordering'] = {\n            'label': _('Ordering'),\n            'choices': ordering_choices,\n            'default': '-created',\n        }\n\n        filters['is_archived'] = {\n            'label': _('Archived'),\n            'choices': [\n                ('', _('All')),\n                ('false', _('No')),\n                ('true', _('Yes')),\n            ],\n            'default': 'false',\n        }\n\n        categories = Category.objects.filter(\n            module=self.module\n        )\n        if categories:\n            category_choices = [('', _('All')), ]\n            if has_icons(self.module):\n                category_icons = []\n            for category in categories:\n                category_choices += (str(category.pk), category.name),\n                if has_icons(self.module):\n                    icon_name = getattr(category, 'icon', None)\n                    icon_url = get_category_icon_url(icon_name)\n                    category_icons += (str(category.pk), icon_url),\n\n            filters['category'] = {\n                'label': _('Category'),\n                'choices': category_choices,\n            }\n            if has_icons(self.module):\n                filters['category']['icons'] = category_icons\n\n        response = super().list(request, args, kwargs)\n        response.data['filters'] = filters\n        return response\n\n\nclass ProposalViewSet(ProposalFilterInfoMixin,\n                      LocaleInfoMixin,\n                      VotingTokenInfoMixin,\n                      mixins.ListModelMixin,\n                      viewsets.GenericViewSet,\n                      ):\n\n    pagination_class = ProposalPagination\n    serializer_class = ProposalSerializer\n    permission_classes = (ViewSetRulesPermission,)\n    filter_backends = (DjangoFilterBackend,\n                       OrderingFilter,\n                       IdeaCategoryFilterBackend,)\n    filter_fields = ('is_archived', 'category',)\n    ordering_fields = ('created',\n                       'comment_count',\n                       'positive_rating_count',)\n\n    def get_permission_object(self):\n        return self.module\n\n    def get_queryset(self):\n        proposals = Proposal.objects\\\n            .filter(module=self.module) \\\n            .annotate_comment_count() \\\n            .annotate_positive_rating_count() \\\n            .annotate_negative_rating_count() \\\n            .order_by('-created')\n        return proposals\n", "path": "meinberlin/apps/budgeting/api.py"}]}