We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Filtering on attendance event on attendees admin doesn't work
This is only relevant for the admin panel and not the dashboard.

```
DisallowedModelAdminLookup at /admin/events/attendee/
Filtering by event__event__title not allowed
```

Can be reproduced by simply going to `/admin/events/attendee/` and filtering by some event.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `apps/events/admin.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 from django.contrib import admin, messages
4 from django.utils.translation import ugettext as _
5 from reversion.admin import VersionAdmin
6 
7 from apps.events.models import (AttendanceEvent, Attendee, CompanyEvent, Event, Extras,
8                                 FieldOfStudyRule, GradeRule, GroupRestriction, Reservation,
9                                 Reservee, RuleBundle, UserGroupRule)
10 from apps.feedback.admin import FeedbackRelationInline
11 
12 
13 class AttendeeInline(admin.TabularInline):
14     model = Attendee
15     extra = 1
16     classes = ('grp-collapse grp-open',)  # style
17     inline_classes = ('grp-collapse grp-open',)  # style
18 
19 
20 class CompanyInline(admin.TabularInline):
21     model = CompanyEvent
22     max_num = 20
23     extra = 0
24     classes = ('grp-collapse grp-open',)  # style
25     inline_classes = ('grp-collapse grp-open',)  # style
26 
27 
28 class RuleBundleInline(admin.TabularInline):
29     model = RuleBundle
30     extra = 1
31     max_num = 20
32     classes = ('grp-collapse grp-open',)  # style
33     inline_classes = ('grp-collapse grp-open',)  # style
34 
35 
36 class ExtrasInline(admin.TabularInline):
37     model = Extras
38     extra = 1
39     max_num = 20
40     classes = ('grp-collapse grp-open',)  # style
41     inline_classes = ('grp-collapse grp-open',)  # style
42 
43 
44 class GroupRestrictionInline(admin.TabularInline):
45     model = GroupRestriction
46     extra = 0
47     max_num = 1
48     classes = ('grp-collapse grp-open',)  # style
49     inline_classes = ('grp-collapse grp-open',)  # style
50     filter_horizontal = ('groups',)
51 
52 
53 def mark_paid(modeladmin, request, queryset):
54     queryset.update(paid=True)
55 mark_paid.short_description = "Merk som betalt"
56 
57 
58 def mark_not_paid(modeladmin, request, queryset):
59     queryset.update(paid=False)
60 mark_not_paid.short_description = "Merk som ikke betalt"
61 
62 
63 def mark_attended(modeladmin, request, queryset):
64     queryset.update(attended=True)
65 mark_attended.short_description = "Merk som møtt"
66 
67 
68 def mark_not_attended(modeladmin, request, queryset):
69     queryset.update(attended=False)
70 mark_not_attended.short_description = "Merk som ikke møtt"
71 
72 
73 class AttendeeAdmin(VersionAdmin):
74     model = Attendee
75     list_display = ('user', 'event', 'paid', 'attended', 'note', 'extras')
76     list_filter = ('event__event__title',)
77     actions = [mark_paid, mark_attended, mark_not_paid, mark_not_attended]
78 
79     # Disable delete_selected http://bit.ly/1o4nleN
80     def get_actions(self, request):
81         actions = super(AttendeeAdmin, self).get_actions(request)
82         if 'delete_selected' in actions:
83             del actions['delete_selected']
84         return actions
85 
86     def delete_model(self, request, obj):
87         event = obj.event.event
88         event.attendance_event.notify_waiting_list(host=request.META['HTTP_HOST'], unattended_user=obj.user)
89         obj.delete()
90 
91 
92 class CompanyEventAdmin(VersionAdmin):
93     model = CompanyEvent
94     inlines = (CompanyInline,)
95 
96 
97 class ExtrasAdmin(VersionAdmin):
98     model = Extras
99     fk_name = 'choice'
100     # inlines = (ExtrasInline,)
101 
102 
103 class RuleBundleAdmin(VersionAdmin):
104     model = RuleBundle
105 
106 
107 class FieldOfStudyRuleAdmin(VersionAdmin):
108     model = FieldOfStudyRule
109 
110 
111 class GradeRuleAdmin(VersionAdmin):
112     model = GradeRule
113 
114 
115 class UserGroupRuleAdmin(VersionAdmin):
116     model = UserGroupRule
117 
118 
119 class AttendanceEventInline(admin.StackedInline):
120     model = AttendanceEvent
121     max_num = 1
122     extra = 0
123     filter_horizontal = ('rule_bundles',)
124     classes = ('grp-collapse grp-open',)  # style
125     inline_classes = ('grp-collapse grp-open',)  # style
126     exclude = ("marks_has_been_set",)
127 
128 
129 class EventAdmin(VersionAdmin):
130     inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline, GroupRestrictionInline)
131     exclude = ("author", )
132     search_fields = ('title',)
133 
134     def save_model(self, request, obj, form, change):
135         if not change:  # created
136             obj.author = request.user
137         else:
138             # If attendance max capacity changed we will notify users that they are now on the attend list
139             old_event = Event.objects.get(id=obj.id)
140             if old_event.is_attendance_event():
141                 old_waitlist_size = old_event.attendance_event.waitlist_qs.count()
142                 if old_waitlist_size > 0:
143                     diff_capacity = obj.attendance_event.max_capacity - old_event.attendance_event.max_capacity
144                     if diff_capacity > 0:
145                         if diff_capacity > old_waitlist_size:
146                             diff_capacity = old_waitlist_size
147                         # Using old_event because max_capacity has already been changed in obj
148                         old_event.attendance_event.notify_waiting_list(host=request.META['HTTP_HOST'],
149                                                                        extra_capacity=diff_capacity)
150         obj.save()
151 
152     def save_formset(self, request, form, formset, change):
153         instances = formset.save(commit=False)
154         for instance in instances:
155             instance.save()
156         formset.save_m2m()
157 
158 
159 class ReserveeInline(admin.TabularInline):
160     model = Reservee
161     extra = 1
162     classes = ('grp-collapse grp-open',)  # style
163     inline_classes = ('grp-collapse grp-open',)  # style
164 
165 
166 class ReservationAdmin(VersionAdmin):
167     model = Reservation
168     inlines = (ReserveeInline,)
169     max_num = 1
170     extra = 0
171     list_display = ('attendance_event', '_number_of_seats_taken', 'seats', '_attendees', '_max_capacity')
172     classes = ('grp-collapse grp-open',)  # style
173     inline_classes = ('grp-collapse grp-open',)  # style
174 
175     def _number_of_seats_taken(self, obj):
176         return obj.number_of_seats_taken
177     _number_of_seats_taken.short_description = _("Fylte reservasjoner")
178 
179     def _attendees(self, obj):
180         return obj.attendance_event.number_of_attendees
181     _attendees.short_description = _("Antall deltakere")
182 
183     def _max_capacity(self, obj):
184         return obj.attendance_event.max_capacity
185     _max_capacity.short_description = _("Arrangementets maks-kapasitet")
186 
187     def save_model(self, request, obj, form, change):
188         attendance_event = AttendanceEvent.objects.get(pk=obj.attendance_event.event)
189         number_of_free_seats = attendance_event.max_capacity - attendance_event.number_of_attendees
190         if number_of_free_seats < obj.seats:
191             obj.seats = number_of_free_seats
192             self.message_user(request, _(
193                 "Du har valgt et antall reserverte plasser som overskrider antallet ledige plasser for dette "
194                 "arrangementet. Antallet ble automatisk justert til %d (alle ledige plasser)."
195             ) % number_of_free_seats, messages.WARNING)
196         obj.save()
197 
198 
199 admin.site.register(Event, EventAdmin)
200 admin.site.register(Attendee, AttendeeAdmin)
201 admin.site.register(RuleBundle, RuleBundleAdmin)
202 admin.site.register(Extras, ExtrasAdmin)
203 admin.site.register(GradeRule, GradeRuleAdmin)
204 admin.site.register(UserGroupRule, UserGroupRuleAdmin)
205 admin.site.register(FieldOfStudyRule, FieldOfStudyRuleAdmin)
206 admin.site.register(Reservation, ReservationAdmin)
207
```
--- 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/apps/events/admin.py b/apps/events/admin.py
--- a/apps/events/admin.py
+++ b/apps/events/admin.py
@@ -73,7 +73,7 @@
 class AttendeeAdmin(VersionAdmin):
     model = Attendee
     list_display = ('user', 'event', 'paid', 'attended', 'note', 'extras')
-    list_filter = ('event__event__title',)
+    list_filter = ('event__event',)
     actions = [mark_paid, mark_attended, mark_not_paid, mark_not_attended]
 
     # Disable delete_selected http://bit.ly/1o4nleN

{"golden_diff": "diff --git a/apps/events/admin.py b/apps/events/admin.py\n--- a/apps/events/admin.py\n+++ b/apps/events/admin.py\n@@ -73,7 +73,7 @@\n class AttendeeAdmin(VersionAdmin):\n     model = Attendee\n     list_display = ('user', 'event', 'paid', 'attended', 'note', 'extras')\n-    list_filter = ('event__event__title',)\n+    list_filter = ('event__event',)\n     actions = [mark_paid, mark_attended, mark_not_paid, mark_not_attended]\n \n     # Disable delete_selected http://bit.ly/1o4nleN\n", "issue": "Filtering on attendance event on attendees admin doesn't work\nThis is only relevant for the admin panel and not the dashboard.\n\n```\nDisallowedModelAdminLookup at /admin/events/attendee/\nFiltering by event__event__title not allowed\n```\n\nCan be reproduced by simply going to `/admin/events/attendee/` and filtering by some event.\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\nfrom django.contrib import admin, messages\nfrom django.utils.translation import ugettext as _\nfrom reversion.admin import VersionAdmin\n\nfrom apps.events.models import (AttendanceEvent, Attendee, CompanyEvent, Event, Extras,\n                                FieldOfStudyRule, GradeRule, GroupRestriction, Reservation,\n                                Reservee, RuleBundle, UserGroupRule)\nfrom apps.feedback.admin import FeedbackRelationInline\n\n\nclass AttendeeInline(admin.TabularInline):\n    model = Attendee\n    extra = 1\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n\nclass CompanyInline(admin.TabularInline):\n    model = CompanyEvent\n    max_num = 20\n    extra = 0\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n\nclass RuleBundleInline(admin.TabularInline):\n    model = RuleBundle\n    extra = 1\n    max_num = 20\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n\nclass ExtrasInline(admin.TabularInline):\n    model = Extras\n    extra = 1\n    max_num = 20\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n\nclass GroupRestrictionInline(admin.TabularInline):\n    model = GroupRestriction\n    extra = 0\n    max_num = 1\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n    filter_horizontal = ('groups',)\n\n\ndef mark_paid(modeladmin, request, queryset):\n    queryset.update(paid=True)\nmark_paid.short_description = \"Merk som betalt\"\n\n\ndef mark_not_paid(modeladmin, request, queryset):\n    queryset.update(paid=False)\nmark_not_paid.short_description = \"Merk som ikke betalt\"\n\n\ndef mark_attended(modeladmin, request, queryset):\n    queryset.update(attended=True)\nmark_attended.short_description = \"Merk som m\u00f8tt\"\n\n\ndef mark_not_attended(modeladmin, request, queryset):\n    queryset.update(attended=False)\nmark_not_attended.short_description = \"Merk som ikke m\u00f8tt\"\n\n\nclass AttendeeAdmin(VersionAdmin):\n    model = Attendee\n    list_display = ('user', 'event', 'paid', 'attended', 'note', 'extras')\n    list_filter = ('event__event__title',)\n    actions = [mark_paid, mark_attended, mark_not_paid, mark_not_attended]\n\n    # Disable delete_selected http://bit.ly/1o4nleN\n    def get_actions(self, request):\n        actions = super(AttendeeAdmin, self).get_actions(request)\n        if 'delete_selected' in actions:\n            del actions['delete_selected']\n        return actions\n\n    def delete_model(self, request, obj):\n        event = obj.event.event\n        event.attendance_event.notify_waiting_list(host=request.META['HTTP_HOST'], unattended_user=obj.user)\n        obj.delete()\n\n\nclass CompanyEventAdmin(VersionAdmin):\n    model = CompanyEvent\n    inlines = (CompanyInline,)\n\n\nclass ExtrasAdmin(VersionAdmin):\n    model = Extras\n    fk_name = 'choice'\n    # inlines = (ExtrasInline,)\n\n\nclass RuleBundleAdmin(VersionAdmin):\n    model = RuleBundle\n\n\nclass FieldOfStudyRuleAdmin(VersionAdmin):\n    model = FieldOfStudyRule\n\n\nclass GradeRuleAdmin(VersionAdmin):\n    model = GradeRule\n\n\nclass UserGroupRuleAdmin(VersionAdmin):\n    model = UserGroupRule\n\n\nclass AttendanceEventInline(admin.StackedInline):\n    model = AttendanceEvent\n    max_num = 1\n    extra = 0\n    filter_horizontal = ('rule_bundles',)\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n    exclude = (\"marks_has_been_set\",)\n\n\nclass EventAdmin(VersionAdmin):\n    inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline, GroupRestrictionInline)\n    exclude = (\"author\", )\n    search_fields = ('title',)\n\n    def save_model(self, request, obj, form, change):\n        if not change:  # created\n            obj.author = request.user\n        else:\n            # If attendance max capacity changed we will notify users that they are now on the attend list\n            old_event = Event.objects.get(id=obj.id)\n            if old_event.is_attendance_event():\n                old_waitlist_size = old_event.attendance_event.waitlist_qs.count()\n                if old_waitlist_size > 0:\n                    diff_capacity = obj.attendance_event.max_capacity - old_event.attendance_event.max_capacity\n                    if diff_capacity > 0:\n                        if diff_capacity > old_waitlist_size:\n                            diff_capacity = old_waitlist_size\n                        # Using old_event because max_capacity has already been changed in obj\n                        old_event.attendance_event.notify_waiting_list(host=request.META['HTTP_HOST'],\n                                                                       extra_capacity=diff_capacity)\n        obj.save()\n\n    def save_formset(self, request, form, formset, change):\n        instances = formset.save(commit=False)\n        for instance in instances:\n            instance.save()\n        formset.save_m2m()\n\n\nclass ReserveeInline(admin.TabularInline):\n    model = Reservee\n    extra = 1\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n\nclass ReservationAdmin(VersionAdmin):\n    model = Reservation\n    inlines = (ReserveeInline,)\n    max_num = 1\n    extra = 0\n    list_display = ('attendance_event', '_number_of_seats_taken', 'seats', '_attendees', '_max_capacity')\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n    def _number_of_seats_taken(self, obj):\n        return obj.number_of_seats_taken\n    _number_of_seats_taken.short_description = _(\"Fylte reservasjoner\")\n\n    def _attendees(self, obj):\n        return obj.attendance_event.number_of_attendees\n    _attendees.short_description = _(\"Antall deltakere\")\n\n    def _max_capacity(self, obj):\n        return obj.attendance_event.max_capacity\n    _max_capacity.short_description = _(\"Arrangementets maks-kapasitet\")\n\n    def save_model(self, request, obj, form, change):\n        attendance_event = AttendanceEvent.objects.get(pk=obj.attendance_event.event)\n        number_of_free_seats = attendance_event.max_capacity - attendance_event.number_of_attendees\n        if number_of_free_seats < obj.seats:\n            obj.seats = number_of_free_seats\n            self.message_user(request, _(\n                \"Du har valgt et antall reserverte plasser som overskrider antallet ledige plasser for dette \"\n                \"arrangementet. Antallet ble automatisk justert til %d (alle ledige plasser).\"\n            ) % number_of_free_seats, messages.WARNING)\n        obj.save()\n\n\nadmin.site.register(Event, EventAdmin)\nadmin.site.register(Attendee, AttendeeAdmin)\nadmin.site.register(RuleBundle, RuleBundleAdmin)\nadmin.site.register(Extras, ExtrasAdmin)\nadmin.site.register(GradeRule, GradeRuleAdmin)\nadmin.site.register(UserGroupRule, UserGroupRuleAdmin)\nadmin.site.register(FieldOfStudyRule, FieldOfStudyRuleAdmin)\nadmin.site.register(Reservation, ReservationAdmin)\n", "path": "apps/events/admin.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\nfrom django.contrib import admin, messages\nfrom django.utils.translation import ugettext as _\nfrom reversion.admin import VersionAdmin\n\nfrom apps.events.models import (AttendanceEvent, Attendee, CompanyEvent, Event, Extras,\n                                FieldOfStudyRule, GradeRule, GroupRestriction, Reservation,\n                                Reservee, RuleBundle, UserGroupRule)\nfrom apps.feedback.admin import FeedbackRelationInline\n\n\nclass AttendeeInline(admin.TabularInline):\n    model = Attendee\n    extra = 1\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n\nclass CompanyInline(admin.TabularInline):\n    model = CompanyEvent\n    max_num = 20\n    extra = 0\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n\nclass RuleBundleInline(admin.TabularInline):\n    model = RuleBundle\n    extra = 1\n    max_num = 20\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n\nclass ExtrasInline(admin.TabularInline):\n    model = Extras\n    extra = 1\n    max_num = 20\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n\nclass GroupRestrictionInline(admin.TabularInline):\n    model = GroupRestriction\n    extra = 0\n    max_num = 1\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n    filter_horizontal = ('groups',)\n\n\ndef mark_paid(modeladmin, request, queryset):\n    queryset.update(paid=True)\nmark_paid.short_description = \"Merk som betalt\"\n\n\ndef mark_not_paid(modeladmin, request, queryset):\n    queryset.update(paid=False)\nmark_not_paid.short_description = \"Merk som ikke betalt\"\n\n\ndef mark_attended(modeladmin, request, queryset):\n    queryset.update(attended=True)\nmark_attended.short_description = \"Merk som m\u00f8tt\"\n\n\ndef mark_not_attended(modeladmin, request, queryset):\n    queryset.update(attended=False)\nmark_not_attended.short_description = \"Merk som ikke m\u00f8tt\"\n\n\nclass AttendeeAdmin(VersionAdmin):\n    model = Attendee\n    list_display = ('user', 'event', 'paid', 'attended', 'note', 'extras')\n    list_filter = ('event__event',)\n    actions = [mark_paid, mark_attended, mark_not_paid, mark_not_attended]\n\n    # Disable delete_selected http://bit.ly/1o4nleN\n    def get_actions(self, request):\n        actions = super(AttendeeAdmin, self).get_actions(request)\n        if 'delete_selected' in actions:\n            del actions['delete_selected']\n        return actions\n\n    def delete_model(self, request, obj):\n        event = obj.event.event\n        event.attendance_event.notify_waiting_list(host=request.META['HTTP_HOST'], unattended_user=obj.user)\n        obj.delete()\n\n\nclass CompanyEventAdmin(VersionAdmin):\n    model = CompanyEvent\n    inlines = (CompanyInline,)\n\n\nclass ExtrasAdmin(VersionAdmin):\n    model = Extras\n    fk_name = 'choice'\n    # inlines = (ExtrasInline,)\n\n\nclass RuleBundleAdmin(VersionAdmin):\n    model = RuleBundle\n\n\nclass FieldOfStudyRuleAdmin(VersionAdmin):\n    model = FieldOfStudyRule\n\n\nclass GradeRuleAdmin(VersionAdmin):\n    model = GradeRule\n\n\nclass UserGroupRuleAdmin(VersionAdmin):\n    model = UserGroupRule\n\n\nclass AttendanceEventInline(admin.StackedInline):\n    model = AttendanceEvent\n    max_num = 1\n    extra = 0\n    filter_horizontal = ('rule_bundles',)\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n    exclude = (\"marks_has_been_set\",)\n\n\nclass EventAdmin(VersionAdmin):\n    inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline, GroupRestrictionInline)\n    exclude = (\"author\", )\n    search_fields = ('title',)\n\n    def save_model(self, request, obj, form, change):\n        if not change:  # created\n            obj.author = request.user\n        else:\n            # If attendance max capacity changed we will notify users that they are now on the attend list\n            old_event = Event.objects.get(id=obj.id)\n            if old_event.is_attendance_event():\n                old_waitlist_size = old_event.attendance_event.waitlist_qs.count()\n                if old_waitlist_size > 0:\n                    diff_capacity = obj.attendance_event.max_capacity - old_event.attendance_event.max_capacity\n                    if diff_capacity > 0:\n                        if diff_capacity > old_waitlist_size:\n                            diff_capacity = old_waitlist_size\n                        # Using old_event because max_capacity has already been changed in obj\n                        old_event.attendance_event.notify_waiting_list(host=request.META['HTTP_HOST'],\n                                                                       extra_capacity=diff_capacity)\n        obj.save()\n\n    def save_formset(self, request, form, formset, change):\n        instances = formset.save(commit=False)\n        for instance in instances:\n            instance.save()\n        formset.save_m2m()\n\n\nclass ReserveeInline(admin.TabularInline):\n    model = Reservee\n    extra = 1\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n\nclass ReservationAdmin(VersionAdmin):\n    model = Reservation\n    inlines = (ReserveeInline,)\n    max_num = 1\n    extra = 0\n    list_display = ('attendance_event', '_number_of_seats_taken', 'seats', '_attendees', '_max_capacity')\n    classes = ('grp-collapse grp-open',)  # style\n    inline_classes = ('grp-collapse grp-open',)  # style\n\n    def _number_of_seats_taken(self, obj):\n        return obj.number_of_seats_taken\n    _number_of_seats_taken.short_description = _(\"Fylte reservasjoner\")\n\n    def _attendees(self, obj):\n        return obj.attendance_event.number_of_attendees\n    _attendees.short_description = _(\"Antall deltakere\")\n\n    def _max_capacity(self, obj):\n        return obj.attendance_event.max_capacity\n    _max_capacity.short_description = _(\"Arrangementets maks-kapasitet\")\n\n    def save_model(self, request, obj, form, change):\n        attendance_event = AttendanceEvent.objects.get(pk=obj.attendance_event.event)\n        number_of_free_seats = attendance_event.max_capacity - attendance_event.number_of_attendees\n        if number_of_free_seats < obj.seats:\n            obj.seats = number_of_free_seats\n            self.message_user(request, _(\n                \"Du har valgt et antall reserverte plasser som overskrider antallet ledige plasser for dette \"\n                \"arrangementet. Antallet ble automatisk justert til %d (alle ledige plasser).\"\n            ) % number_of_free_seats, messages.WARNING)\n        obj.save()\n\n\nadmin.site.register(Event, EventAdmin)\nadmin.site.register(Attendee, AttendeeAdmin)\nadmin.site.register(RuleBundle, RuleBundleAdmin)\nadmin.site.register(Extras, ExtrasAdmin)\nadmin.site.register(GradeRule, GradeRuleAdmin)\nadmin.site.register(UserGroupRule, UserGroupRuleAdmin)\nadmin.site.register(FieldOfStudyRule, FieldOfStudyRuleAdmin)\nadmin.site.register(Reservation, ReservationAdmin)\n", "path": "apps/events/admin.py"}]}