prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Hide attendanceevent from django admin
  https://online.ntnu.no/admin/events/attendanceevent/
  
  This view should not be used by anyone and attendance info should be edited through the event directly. 
  
  Should be possible to hide this by removing 
  `admin.site.register(AttendanceEvent, AttendanceEventAdmin)`
   in events/admin.py (untested)
  
  
  --- 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 import forms
  4 from django.contrib import admin
  5 from django.core import validators
  6 from django.utils.translation import ugettext as _
  7 
  8 from apps.events.models import Event
  9 from apps.events.models import AttendanceEvent
  10 from apps.events.models import Attendee
  11 from apps.events.models import CompanyEvent
  12 from apps.events.models import RuleBundle
  13 from apps.events.models import FieldOfStudyRule
  14 from apps.events.models import GradeRule
  15 from apps.events.models import UserGroupRule
  16 from apps.feedback.admin import FeedbackRelationInline
  17 
  18 
  19 
  20 class AttendeeInline(admin.TabularInline):
  21     model = Attendee
  22     extra = 1
  23     classes = ('grp-collapse grp-open',)  # style
  24     inline_classes = ('grp-collapse grp-open',)  # style
  25 
  26 
  27 class CompanyInline(admin.TabularInline):
  28     model = CompanyEvent
  29     max_num = 20
  30     extra = 0
  31     classes = ('grp-collapse grp-open',)  # style
  32     inline_classes = ('grp-collapse grp-open',)  # style
  33 
  34 
  35 class RuleBundleInline(admin.TabularInline):
  36     model = RuleBundle
  37     extra = 1
  38     max_num = 20
  39     classes = ('grp-collapse grp-open',)  # style
  40     inline_classes = ('grp-collapse grp-open',)  # style
  41 
  42 
  43 class AttendanceEventAdmin(admin.ModelAdmin):
  44     model = AttendanceEvent
  45     inlines = (AttendeeInline, RuleBundleInline)
  46 
  47 
  48 class AttendeeAdmin(admin.ModelAdmin):
  49     model = Attendee
  50     list_display = ('user', 'event', 'paid')
  51     actions = None
  52 
  53     def delete_model(self, request, obj):
  54         event = obj.event.event
  55         event.notify_waiting_list(host=request.META['HTTP_HOST'], unattended_user=obj.user)
  56         obj.delete()
  57 
  58 
  59 class CompanyEventAdmin(admin.ModelAdmin):
  60     model = CompanyEvent
  61     inlines = (CompanyInline,)
  62 
  63 
  64 class RuleBundleAdmin(admin.ModelAdmin):
  65     model = RuleBundle
  66 
  67 
  68 class FieldOfStudyRuleAdmin(admin.ModelAdmin):
  69     model = FieldOfStudyRule
  70 
  71 
  72 class GradeRuleAdmin(admin.ModelAdmin):
  73     model = GradeRule
  74 
  75 
  76 class UserGroupRuleAdmin(admin.ModelAdmin):
  77     model = UserGroupRule
  78 
  79 
  80 class AttendanceEventInline(admin.StackedInline):
  81     model = AttendanceEvent
  82     max_num = 1
  83     extra = 0
  84     filter_horizontal = ('rule_bundles',)
  85     classes = ('grp-collapse grp-open',)  # style
  86     inline_classes = ('grp-collapse grp-open',)  # style
  87 
  88 
  89 class EventAdmin(admin.ModelAdmin):
  90     inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline)
  91     exclude = ("author", )
  92     search_fields = ('title',)
  93 
  94     def save_model(self, request, obj, form, change):
  95         if not change:  # created
  96             obj.author = request.user
  97         else:
  98             # If attendance max capacity changed we will notify users that they are now on the attend list
  99             old_event = Event.objects.get(id=obj.id)
  100             if old_event.is_attendance_event() and old_event.wait_list:
  101                 diff_capacity = obj.attendance_event.max_capacity - old_event.attendance_event.max_capacity
  102                 if diff_capacity > 0:
  103                     if diff_capacity > len(old_event.wait_list):
  104                         diff_capacity = len(old_event.wait_list)
  105                     # Using old_event because max_capacity has already been changed in obj
  106                     old_event.notify_waiting_list(host=request.META['HTTP_HOST'], extra_capacity=diff_capacity)
  107         obj.save()
  108 
  109     def save_formset(self, request, form, formset, change):
  110         instances = formset.save(commit=False)
  111         for instance in instances:
  112             instance.save()
  113         formset.save_m2m()
  114 
  115     def get_form(self, request, obj=None, **kwargs):
  116         form = super(EventAdmin, self).get_form(request, obj, **kwargs)
  117         form.base_fields['ingress_short'].validators=[validators.MinLengthValidator(50)]
  118         form.base_fields['ingress'].validators=[validators.MinLengthValidator(75)]
  119         form.base_fields['description'].validators=[validators.MinLengthValidator(140)]
  120         return form
  121 
  122 admin.site.register(Event, EventAdmin)
  123 admin.site.register(Attendee, AttendeeAdmin)
  124 admin.site.register(AttendanceEvent, AttendanceEventAdmin)
  125 admin.site.register(RuleBundle, RuleBundleAdmin)
  126 admin.site.register(GradeRule, GradeRuleAdmin)
  127 admin.site.register(UserGroupRule, UserGroupRuleAdmin)
  128 admin.site.register(FieldOfStudyRule, FieldOfStudyRuleAdmin)
  129
  ```
  --- 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/apps/events/admin.py b/apps/events/admin.py
  --- a/apps/events/admin.py
  +++ b/apps/events/admin.py
  @@ -40,11 +40,6 @@
       inline_classes = ('grp-collapse grp-open',)  # style
   
   
  -class AttendanceEventAdmin(admin.ModelAdmin):
  -    model = AttendanceEvent
  -    inlines = (AttendeeInline, RuleBundleInline)
  -
  -
   class AttendeeAdmin(admin.ModelAdmin):
       model = Attendee
       list_display = ('user', 'event', 'paid')
  @@ -119,9 +114,9 @@
           form.base_fields['description'].validators=[validators.MinLengthValidator(140)]
           return form
   
  +
   admin.site.register(Event, EventAdmin)
   admin.site.register(Attendee, AttendeeAdmin)
  -admin.site.register(AttendanceEvent, AttendanceEventAdmin)
   admin.site.register(RuleBundle, RuleBundleAdmin)
   admin.site.register(GradeRule, GradeRuleAdmin)
   admin.site.register(UserGroupRule, UserGroupRuleAdmin)
  
verification_info: {"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@@ -40,11 +40,6 @@\n     inline_classes = ('grp-collapse grp-open',)  # style\n \n \n-class AttendanceEventAdmin(admin.ModelAdmin):\n-    model = AttendanceEvent\n-    inlines = (AttendeeInline, RuleBundleInline)\n-\n-\n class AttendeeAdmin(admin.ModelAdmin):\n     model = Attendee\n     list_display = ('user', 'event', 'paid')\n@@ -119,9 +114,9 @@\n         form.base_fields['description'].validators=[validators.MinLengthValidator(140)]\n         return form\n \n+\n admin.site.register(Event, EventAdmin)\n admin.site.register(Attendee, AttendeeAdmin)\n-admin.site.register(AttendanceEvent, AttendanceEventAdmin)\n admin.site.register(RuleBundle, RuleBundleAdmin)\n admin.site.register(GradeRule, GradeRuleAdmin)\n admin.site.register(UserGroupRule, UserGroupRuleAdmin)\n", "issue": "Hide attendanceevent from django admin\nhttps://online.ntnu.no/admin/events/attendanceevent/\n\nThis view should not be used by anyone and attendance info should be edited through the event directly. \n\nShould be possible to hide this by removing \n`admin.site.register(AttendanceEvent, AttendanceEventAdmin)`\n in events/admin.py (untested)\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\nfrom django import forms\nfrom django.contrib import admin\nfrom django.core import validators\nfrom django.utils.translation import ugettext as _\n\nfrom apps.events.models import Event\nfrom apps.events.models import AttendanceEvent\nfrom apps.events.models import Attendee\nfrom apps.events.models import CompanyEvent\nfrom apps.events.models import RuleBundle\nfrom apps.events.models import FieldOfStudyRule\nfrom apps.events.models import GradeRule\nfrom apps.events.models import UserGroupRule\nfrom apps.feedback.admin import FeedbackRelationInline\n\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 AttendanceEventAdmin(admin.ModelAdmin):\n    model = AttendanceEvent\n    inlines = (AttendeeInline, RuleBundleInline)\n\n\nclass AttendeeAdmin(admin.ModelAdmin):\n    model = Attendee\n    list_display = ('user', 'event', 'paid')\n    actions = None\n\n    def delete_model(self, request, obj):\n        event = obj.event.event\n        event.notify_waiting_list(host=request.META['HTTP_HOST'], unattended_user=obj.user)\n        obj.delete()\n\n\nclass CompanyEventAdmin(admin.ModelAdmin):\n    model = CompanyEvent\n    inlines = (CompanyInline,)\n\n\nclass RuleBundleAdmin(admin.ModelAdmin):\n    model = RuleBundle\n\n\nclass FieldOfStudyRuleAdmin(admin.ModelAdmin):\n    model = FieldOfStudyRule\n\n\nclass GradeRuleAdmin(admin.ModelAdmin):\n    model = GradeRule\n\n\nclass UserGroupRuleAdmin(admin.ModelAdmin):\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\n\nclass EventAdmin(admin.ModelAdmin):\n    inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline)\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() and old_event.wait_list:\n                diff_capacity = obj.attendance_event.max_capacity - old_event.attendance_event.max_capacity\n                if diff_capacity > 0:\n                    if diff_capacity > len(old_event.wait_list):\n                        diff_capacity = len(old_event.wait_list)\n                    # Using old_event because max_capacity has already been changed in obj\n                    old_event.notify_waiting_list(host=request.META['HTTP_HOST'], 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    def get_form(self, request, obj=None, **kwargs):\n        form = super(EventAdmin, self).get_form(request, obj, **kwargs)\n        form.base_fields['ingress_short'].validators=[validators.MinLengthValidator(50)]\n        form.base_fields['ingress'].validators=[validators.MinLengthValidator(75)]\n        form.base_fields['description'].validators=[validators.MinLengthValidator(140)]\n        return form\n\nadmin.site.register(Event, EventAdmin)\nadmin.site.register(Attendee, AttendeeAdmin)\nadmin.site.register(AttendanceEvent, AttendanceEventAdmin)\nadmin.site.register(RuleBundle, RuleBundleAdmin)\nadmin.site.register(GradeRule, GradeRuleAdmin)\nadmin.site.register(UserGroupRule, UserGroupRuleAdmin)\nadmin.site.register(FieldOfStudyRule, FieldOfStudyRuleAdmin)\n", "path": "apps/events/admin.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\nfrom django import forms\nfrom django.contrib import admin\nfrom django.core import validators\nfrom django.utils.translation import ugettext as _\n\nfrom apps.events.models import Event\nfrom apps.events.models import AttendanceEvent\nfrom apps.events.models import Attendee\nfrom apps.events.models import CompanyEvent\nfrom apps.events.models import RuleBundle\nfrom apps.events.models import FieldOfStudyRule\nfrom apps.events.models import GradeRule\nfrom apps.events.models import UserGroupRule\nfrom apps.feedback.admin import FeedbackRelationInline\n\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 AttendeeAdmin(admin.ModelAdmin):\n    model = Attendee\n    list_display = ('user', 'event', 'paid')\n    actions = None\n\n    def delete_model(self, request, obj):\n        event = obj.event.event\n        event.notify_waiting_list(host=request.META['HTTP_HOST'], unattended_user=obj.user)\n        obj.delete()\n\n\nclass CompanyEventAdmin(admin.ModelAdmin):\n    model = CompanyEvent\n    inlines = (CompanyInline,)\n\n\nclass RuleBundleAdmin(admin.ModelAdmin):\n    model = RuleBundle\n\n\nclass FieldOfStudyRuleAdmin(admin.ModelAdmin):\n    model = FieldOfStudyRule\n\n\nclass GradeRuleAdmin(admin.ModelAdmin):\n    model = GradeRule\n\n\nclass UserGroupRuleAdmin(admin.ModelAdmin):\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\n\nclass EventAdmin(admin.ModelAdmin):\n    inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline)\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() and old_event.wait_list:\n                diff_capacity = obj.attendance_event.max_capacity - old_event.attendance_event.max_capacity\n                if diff_capacity > 0:\n                    if diff_capacity > len(old_event.wait_list):\n                        diff_capacity = len(old_event.wait_list)\n                    # Using old_event because max_capacity has already been changed in obj\n                    old_event.notify_waiting_list(host=request.META['HTTP_HOST'], 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    def get_form(self, request, obj=None, **kwargs):\n        form = super(EventAdmin, self).get_form(request, obj, **kwargs)\n        form.base_fields['ingress_short'].validators=[validators.MinLengthValidator(50)]\n        form.base_fields['ingress'].validators=[validators.MinLengthValidator(75)]\n        form.base_fields['description'].validators=[validators.MinLengthValidator(140)]\n        return form\n\n\nadmin.site.register(Event, EventAdmin)\nadmin.site.register(Attendee, AttendeeAdmin)\nadmin.site.register(RuleBundle, RuleBundleAdmin)\nadmin.site.register(GradeRule, GradeRuleAdmin)\nadmin.site.register(UserGroupRule, UserGroupRuleAdmin)\nadmin.site.register(FieldOfStudyRule, FieldOfStudyRuleAdmin)\n", "path": "apps/events/admin.py"}]}