prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Bug: Internal Server Error: /fiscal/organizations/
  Production issue.
  
  ```
  FieldError at /fiscal/organizations/
  Cannot resolve keyword 'membership' into field. Choices are: administered_events, affiliated_organizations, country, domain, fullname, hosted_events, id, latitude, longitude, member, memberships, selforganisedsubmission, sponsored_events, workshopinquiryrequest, workshoprequest
  ```
  
  https://amy.carpentries.org/fiscal/organizations/?country=&membership__variant=silver&order_by=
  
  </issue>
  <code>
  [start of amy/fiscal/filters.py]
  1 from datetime import date
  2 
  3 from django.forms import widgets
  4 import django_filters
  5 
  6 from workshops.fields import Select2MultipleWidget, Select2Widget
  7 from workshops.filters import AllCountriesFilter, AMYFilterSet
  8 from workshops.models import Membership, Organization
  9 
  10 
  11 class OrganizationFilter(AMYFilterSet):
  12     country = AllCountriesFilter(widget=Select2Widget)
  13 
  14     membership__variant = django_filters.MultipleChoiceFilter(
  15         label="Memberships (current or past)",
  16         choices=Membership.MEMBERSHIP_CHOICES,
  17         widget=Select2MultipleWidget,
  18     )
  19 
  20     order_by = django_filters.OrderingFilter(
  21         fields=(
  22             "fullname",
  23             "domain",
  24         ),
  25     )
  26 
  27     class Meta:
  28         model = Organization
  29         fields = [
  30             "country",
  31         ]
  32 
  33 
  34 def filter_active_memberships_only(queryset, name, active):
  35     """Limit Memberships to only active entries."""
  36     if active:
  37         today = date.today()
  38         return queryset.filter(agreement_start__lte=today, agreement_end__gte=today)
  39     else:
  40         return queryset
  41 
  42 
  43 def filter_training_seats_only(queryset, name, seats):
  44     """Limit Memberships to only entries with some training seats allowed."""
  45     if seats:
  46         return queryset.filter(instructor_training_seats_total__gt=0)
  47     else:
  48         return queryset
  49 
  50 
  51 def filter_nonpositive_remaining_seats(queryset, name, seats):
  52     """Limit Memberships to only entries with negative remaining seats."""
  53     if seats:
  54         return queryset.filter(instructor_training_seats_remaining__lt=0)
  55     else:
  56         return queryset
  57 
  58 
  59 class MembershipFilter(AMYFilterSet):
  60     organization_name = django_filters.CharFilter(
  61         label="Organisation name",
  62         field_name="organizations__fullname",
  63         lookup_expr="icontains",
  64     )
  65 
  66     MEMBERSHIP_CHOICES = (("", "Any"),) + Membership.MEMBERSHIP_CHOICES
  67     variant = django_filters.ChoiceFilter(choices=MEMBERSHIP_CHOICES)
  68 
  69     CONTRIBUTION_CHOICES = (("", "Any"),) + Membership.CONTRIBUTION_CHOICES
  70     contribution_type = django_filters.ChoiceFilter(choices=CONTRIBUTION_CHOICES)
  71 
  72     active_only = django_filters.BooleanFilter(
  73         label="Only show active memberships",
  74         method=filter_active_memberships_only,
  75         widget=widgets.CheckboxInput,
  76     )
  77 
  78     training_seats_only = django_filters.BooleanFilter(
  79         label="Only show memberships with non-zero allowed training seats",
  80         method=filter_training_seats_only,
  81         widget=widgets.CheckboxInput,
  82     )
  83 
  84     nonpositive_remaining_seats_only = django_filters.BooleanFilter(
  85         label="Only show memberships with zero or less remaining seats",
  86         method=filter_nonpositive_remaining_seats,
  87         widget=widgets.CheckboxInput,
  88     )
  89 
  90     order_by = django_filters.OrderingFilter(
  91         fields=(
  92             "agreement_start",
  93             "agreement_end",
  94             "instructor_training_seats_remaining",
  95         ),
  96     )
  97 
  98     class Meta:
  99         model = Membership
  100         fields = [
  101             "organization_name",
  102             "consortium",
  103             "public_status",
  104             "variant",
  105             "contribution_type",
  106         ]
  107 
  108 
  109 class MembershipTrainingsFilter(AMYFilterSet):
  110     organization_name = django_filters.CharFilter(
  111         label="Organization name",
  112         field_name="organization__fullname",
  113         lookup_expr="icontains",
  114     )
  115 
  116     active_only = django_filters.BooleanFilter(
  117         label="Only show active memberships",
  118         method=filter_active_memberships_only,
  119         widget=widgets.CheckboxInput,
  120     )
  121 
  122     training_seats_only = django_filters.BooleanFilter(
  123         label="Only show memberships with non-zero allowed training seats",
  124         method=filter_training_seats_only,
  125         widget=widgets.CheckboxInput,
  126     )
  127 
  128     nonpositive_remaining_seats_only = django_filters.BooleanFilter(
  129         label="Only show memberships with zero or less remaining seats",
  130         method=filter_nonpositive_remaining_seats,
  131         widget=widgets.CheckboxInput,
  132     )
  133 
  134     order_by = django_filters.OrderingFilter(
  135         fields=(
  136             "organization__fullname",
  137             "organization__domain",
  138             "agreement_start",
  139             "agreement_end",
  140             "instructor_training_seats_total",
  141             "instructor_training_seats_utilized",
  142             "instructor_training_seats_remaining",
  143         ),
  144     )
  145 
  146     class Meta:
  147         model = Membership
  148         fields = [
  149             "organization_name",
  150         ]
  151
  [end of amy/fiscal/filters.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/amy/fiscal/filters.py b/amy/fiscal/filters.py
  --- a/amy/fiscal/filters.py
  +++ b/amy/fiscal/filters.py
  @@ -11,7 +11,7 @@
   class OrganizationFilter(AMYFilterSet):
       country = AllCountriesFilter(widget=Select2Widget)
   
  -    membership__variant = django_filters.MultipleChoiceFilter(
  +    memberships__variant = django_filters.MultipleChoiceFilter(
           label="Memberships (current or past)",
           choices=Membership.MEMBERSHIP_CHOICES,
           widget=Select2MultipleWidget,
  
verification_info: {"golden_diff": "diff --git a/amy/fiscal/filters.py b/amy/fiscal/filters.py\n--- a/amy/fiscal/filters.py\n+++ b/amy/fiscal/filters.py\n@@ -11,7 +11,7 @@\n class OrganizationFilter(AMYFilterSet):\n     country = AllCountriesFilter(widget=Select2Widget)\n \n-    membership__variant = django_filters.MultipleChoiceFilter(\n+    memberships__variant = django_filters.MultipleChoiceFilter(\n         label=\"Memberships (current or past)\",\n         choices=Membership.MEMBERSHIP_CHOICES,\n         widget=Select2MultipleWidget,\n", "issue": "Bug: Internal Server Error: /fiscal/organizations/\nProduction issue.\r\n\r\n```\r\nFieldError at /fiscal/organizations/\r\nCannot resolve keyword 'membership' into field. Choices are: administered_events, affiliated_organizations, country, domain, fullname, hosted_events, id, latitude, longitude, member, memberships, selforganisedsubmission, sponsored_events, workshopinquiryrequest, workshoprequest\r\n```\r\n\r\nhttps://amy.carpentries.org/fiscal/organizations/?country=&membership__variant=silver&order_by=\n", "before_files": [{"content": "from datetime import date\n\nfrom django.forms import widgets\nimport django_filters\n\nfrom workshops.fields import Select2MultipleWidget, Select2Widget\nfrom workshops.filters import AllCountriesFilter, AMYFilterSet\nfrom workshops.models import Membership, Organization\n\n\nclass OrganizationFilter(AMYFilterSet):\n    country = AllCountriesFilter(widget=Select2Widget)\n\n    membership__variant = django_filters.MultipleChoiceFilter(\n        label=\"Memberships (current or past)\",\n        choices=Membership.MEMBERSHIP_CHOICES,\n        widget=Select2MultipleWidget,\n    )\n\n    order_by = django_filters.OrderingFilter(\n        fields=(\n            \"fullname\",\n            \"domain\",\n        ),\n    )\n\n    class Meta:\n        model = Organization\n        fields = [\n            \"country\",\n        ]\n\n\ndef filter_active_memberships_only(queryset, name, active):\n    \"\"\"Limit Memberships to only active entries.\"\"\"\n    if active:\n        today = date.today()\n        return queryset.filter(agreement_start__lte=today, agreement_end__gte=today)\n    else:\n        return queryset\n\n\ndef filter_training_seats_only(queryset, name, seats):\n    \"\"\"Limit Memberships to only entries with some training seats allowed.\"\"\"\n    if seats:\n        return queryset.filter(instructor_training_seats_total__gt=0)\n    else:\n        return queryset\n\n\ndef filter_nonpositive_remaining_seats(queryset, name, seats):\n    \"\"\"Limit Memberships to only entries with negative remaining seats.\"\"\"\n    if seats:\n        return queryset.filter(instructor_training_seats_remaining__lt=0)\n    else:\n        return queryset\n\n\nclass MembershipFilter(AMYFilterSet):\n    organization_name = django_filters.CharFilter(\n        label=\"Organisation name\",\n        field_name=\"organizations__fullname\",\n        lookup_expr=\"icontains\",\n    )\n\n    MEMBERSHIP_CHOICES = ((\"\", \"Any\"),) + Membership.MEMBERSHIP_CHOICES\n    variant = django_filters.ChoiceFilter(choices=MEMBERSHIP_CHOICES)\n\n    CONTRIBUTION_CHOICES = ((\"\", \"Any\"),) + Membership.CONTRIBUTION_CHOICES\n    contribution_type = django_filters.ChoiceFilter(choices=CONTRIBUTION_CHOICES)\n\n    active_only = django_filters.BooleanFilter(\n        label=\"Only show active memberships\",\n        method=filter_active_memberships_only,\n        widget=widgets.CheckboxInput,\n    )\n\n    training_seats_only = django_filters.BooleanFilter(\n        label=\"Only show memberships with non-zero allowed training seats\",\n        method=filter_training_seats_only,\n        widget=widgets.CheckboxInput,\n    )\n\n    nonpositive_remaining_seats_only = django_filters.BooleanFilter(\n        label=\"Only show memberships with zero or less remaining seats\",\n        method=filter_nonpositive_remaining_seats,\n        widget=widgets.CheckboxInput,\n    )\n\n    order_by = django_filters.OrderingFilter(\n        fields=(\n            \"agreement_start\",\n            \"agreement_end\",\n            \"instructor_training_seats_remaining\",\n        ),\n    )\n\n    class Meta:\n        model = Membership\n        fields = [\n            \"organization_name\",\n            \"consortium\",\n            \"public_status\",\n            \"variant\",\n            \"contribution_type\",\n        ]\n\n\nclass MembershipTrainingsFilter(AMYFilterSet):\n    organization_name = django_filters.CharFilter(\n        label=\"Organization name\",\n        field_name=\"organization__fullname\",\n        lookup_expr=\"icontains\",\n    )\n\n    active_only = django_filters.BooleanFilter(\n        label=\"Only show active memberships\",\n        method=filter_active_memberships_only,\n        widget=widgets.CheckboxInput,\n    )\n\n    training_seats_only = django_filters.BooleanFilter(\n        label=\"Only show memberships with non-zero allowed training seats\",\n        method=filter_training_seats_only,\n        widget=widgets.CheckboxInput,\n    )\n\n    nonpositive_remaining_seats_only = django_filters.BooleanFilter(\n        label=\"Only show memberships with zero or less remaining seats\",\n        method=filter_nonpositive_remaining_seats,\n        widget=widgets.CheckboxInput,\n    )\n\n    order_by = django_filters.OrderingFilter(\n        fields=(\n            \"organization__fullname\",\n            \"organization__domain\",\n            \"agreement_start\",\n            \"agreement_end\",\n            \"instructor_training_seats_total\",\n            \"instructor_training_seats_utilized\",\n            \"instructor_training_seats_remaining\",\n        ),\n    )\n\n    class Meta:\n        model = Membership\n        fields = [\n            \"organization_name\",\n        ]\n", "path": "amy/fiscal/filters.py"}]}