prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  (Event) Minimum length on event description and ingress
  Possibly we should also limit the text to exclude words like TBA.
  
  Events in ow4 demand some text in order to look good, so let's put a minimum requirement on length for the event texts. Making up a description of 200 characters should be no big deal.
  
  I've really had it with "INFO: TBA"
  
  
  --- 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 apps.events.models import Event
  4 from apps.events.models import AttendanceEvent
  5 from apps.events.models import Attendee
  6 from apps.events.models import CompanyEvent
  7 from apps.events.models import RuleBundle
  8 from apps.events.models import FieldOfStudyRule
  9 from apps.events.models import GradeRule
  10 from apps.events.models import UserGroupRule
  11 
  12 from apps.feedback.admin import FeedbackRelationInline
  13 
  14 from django.contrib import admin
  15 
  16 
  17 class AttendeeInline(admin.TabularInline):
  18     model = Attendee
  19     extra = 1
  20 
  21 
  22 class CompanyInline(admin.TabularInline):
  23     model = CompanyEvent
  24     max_num = 20
  25     extra = 0
  26 
  27 class RuleBundleInline(admin.TabularInline):
  28     model = RuleBundle
  29     extra = 1
  30     max_num = 20
  31 
  32 
  33 class AttendanceEventAdmin(admin.ModelAdmin):
  34     model = AttendanceEvent
  35     inlines = (AttendeeInline, RuleBundleInline)
  36 
  37 class AttendeeAdmin(admin.ModelAdmin):
  38     model = Attendee
  39     list_display = ('user', 'event')
  40 
  41 class CompanyEventAdmin(admin.ModelAdmin):
  42     model = CompanyEvent
  43     inlines = (CompanyInline,)
  44 
  45 class RuleBundleAdmin(admin.ModelAdmin):
  46     model = RuleBundle
  47    
  48 class FieldOfStudyRuleAdmin(admin.ModelAdmin):
  49     model = FieldOfStudyRule
  50 
  51 class GradeRuleAdmin(admin.ModelAdmin):
  52     model = GradeRule
  53 
  54 class UserGroupRuleAdmin(admin.ModelAdmin):
  55     model = UserGroupRule
  56 
  57 class AttendanceEventInline(admin.StackedInline):
  58     model = AttendanceEvent
  59     max_num = 1
  60     extra = 0
  61     filter_horizontal = ('rule_bundles',)
  62     
  63 
  64 class EventAdmin(admin.ModelAdmin):
  65     inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline)
  66     exclude = ("author", )
  67 
  68     def save_model(self, request, obj, form, change):
  69         if not change:  # created
  70             obj.author = request.user
  71         obj.save()
  72 
  73     def save_formset(self, request, form, formset, change):
  74         instances = formset.save(commit=False)
  75         for instance in instances:
  76             instance.save()
  77         formset.save_m2m()
  78 
  79 admin.site.register(Event, EventAdmin)
  80 admin.site.register(Attendee, AttendeeAdmin)
  81 admin.site.register(AttendanceEvent, AttendanceEventAdmin)
  82 admin.site.register(RuleBundle, RuleBundleAdmin)
  83 admin.site.register(GradeRule, GradeRuleAdmin)
  84 admin.site.register(UserGroupRule, UserGroupRuleAdmin)
  85 admin.site.register(FieldOfStudyRule, FieldOfStudyRuleAdmin)
  86
  ```
  --- 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
  @@ -1,5 +1,10 @@
   # -*- coding: utf-8 -*-
   
  +from django import forms
  +from django.contrib import admin
  +from django.core import validators
  +from django.utils.translation import ugettext as _
  +
   from apps.events.models import Event
   from apps.events.models import AttendanceEvent
   from apps.events.models import Attendee
  @@ -8,10 +13,8 @@
   from apps.events.models import FieldOfStudyRule
   from apps.events.models import GradeRule
   from apps.events.models import UserGroupRule
  -
   from apps.feedback.admin import FeedbackRelationInline
   
  -from django.contrib import admin
   
   
   class AttendeeInline(admin.TabularInline):
  @@ -24,6 +27,7 @@
       max_num = 20
       extra = 0
   
  +
   class RuleBundleInline(admin.TabularInline):
       model = RuleBundle
       extra = 1
  @@ -34,32 +38,39 @@
       model = AttendanceEvent
       inlines = (AttendeeInline, RuleBundleInline)
   
  +
   class AttendeeAdmin(admin.ModelAdmin):
       model = Attendee
       list_display = ('user', 'event')
   
  +
   class CompanyEventAdmin(admin.ModelAdmin):
       model = CompanyEvent
       inlines = (CompanyInline,)
   
  +
   class RuleBundleAdmin(admin.ModelAdmin):
       model = RuleBundle
  -   
  +
  +
   class FieldOfStudyRuleAdmin(admin.ModelAdmin):
       model = FieldOfStudyRule
   
  +
   class GradeRuleAdmin(admin.ModelAdmin):
       model = GradeRule
   
  +
   class UserGroupRuleAdmin(admin.ModelAdmin):
       model = UserGroupRule
   
  +
   class AttendanceEventInline(admin.StackedInline):
       model = AttendanceEvent
       max_num = 1
       extra = 0
       filter_horizontal = ('rule_bundles',)
  -    
  +
   
   class EventAdmin(admin.ModelAdmin):
       inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline)
  @@ -76,6 +87,16 @@
               instance.save()
           formset.save_m2m()
   
  +    def get_form(self, request, obj=None, **kwargs):
  +        form = super(EventAdmin, self).get_form(request, obj, **kwargs)
  +        form.base_fields['ingress_short'].validators=[validators.MinLengthValidator(75)]
  +        form.base_fields['ingress'].validators=[validators.MinLengthValidator(100)]
  +        form.base_fields['description'].validators=[
  +                                                    validators.MinLengthValidator(200),
  +                                                    validators.RegexValidator("^(?:(?!TBA).)*$", _("Beskrivelsen kan ikke inneholde 'TBA'."), "ulovlig"),
  +                                                    ]
  +        return form
  +
   admin.site.register(Event, EventAdmin)
   admin.site.register(Attendee, AttendeeAdmin)
   admin.site.register(AttendanceEvent, AttendanceEventAdmin)
  
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@@ -1,5 +1,10 @@\n # -*- coding: utf-8 -*-\n \n+from django import forms\n+from django.contrib import admin\n+from django.core import validators\n+from django.utils.translation import ugettext as _\n+\n from apps.events.models import Event\n from apps.events.models import AttendanceEvent\n from apps.events.models import Attendee\n@@ -8,10 +13,8 @@\n from apps.events.models import FieldOfStudyRule\n from apps.events.models import GradeRule\n from apps.events.models import UserGroupRule\n-\n from apps.feedback.admin import FeedbackRelationInline\n \n-from django.contrib import admin\n \n \n class AttendeeInline(admin.TabularInline):\n@@ -24,6 +27,7 @@\n     max_num = 20\n     extra = 0\n \n+\n class RuleBundleInline(admin.TabularInline):\n     model = RuleBundle\n     extra = 1\n@@ -34,32 +38,39 @@\n     model = AttendanceEvent\n     inlines = (AttendeeInline, RuleBundleInline)\n \n+\n class AttendeeAdmin(admin.ModelAdmin):\n     model = Attendee\n     list_display = ('user', 'event')\n \n+\n class CompanyEventAdmin(admin.ModelAdmin):\n     model = CompanyEvent\n     inlines = (CompanyInline,)\n \n+\n class RuleBundleAdmin(admin.ModelAdmin):\n     model = RuleBundle\n-   \n+\n+\n class FieldOfStudyRuleAdmin(admin.ModelAdmin):\n     model = FieldOfStudyRule\n \n+\n class GradeRuleAdmin(admin.ModelAdmin):\n     model = GradeRule\n \n+\n class UserGroupRuleAdmin(admin.ModelAdmin):\n     model = UserGroupRule\n \n+\n class AttendanceEventInline(admin.StackedInline):\n     model = AttendanceEvent\n     max_num = 1\n     extra = 0\n     filter_horizontal = ('rule_bundles',)\n-    \n+\n \n class EventAdmin(admin.ModelAdmin):\n     inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline)\n@@ -76,6 +87,16 @@\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(75)]\n+        form.base_fields['ingress'].validators=[validators.MinLengthValidator(100)]\n+        form.base_fields['description'].validators=[\n+                                                    validators.MinLengthValidator(200),\n+                                                    validators.RegexValidator(\"^(?:(?!TBA).)*$\", _(\"Beskrivelsen kan ikke inneholde 'TBA'.\"), \"ulovlig\"),\n+                                                    ]\n+        return form\n+\n admin.site.register(Event, EventAdmin)\n admin.site.register(Attendee, AttendeeAdmin)\n admin.site.register(AttendanceEvent, AttendanceEventAdmin)\n", "issue": "(Event) Minimum length on event description and ingress\nPossibly we should also limit the text to exclude words like TBA.\n\nEvents in ow4 demand some text in order to look good, so let's put a minimum requirement on length for the event texts. Making up a description of 200 characters should be no big deal.\n\nI've really had it with \"INFO: TBA\"\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\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\n\nfrom apps.feedback.admin import FeedbackRelationInline\n\nfrom django.contrib import admin\n\n\nclass AttendeeInline(admin.TabularInline):\n    model = Attendee\n    extra = 1\n\n\nclass CompanyInline(admin.TabularInline):\n    model = CompanyEvent\n    max_num = 20\n    extra = 0\n\nclass RuleBundleInline(admin.TabularInline):\n    model = RuleBundle\n    extra = 1\n    max_num = 20\n\n\nclass AttendanceEventAdmin(admin.ModelAdmin):\n    model = AttendanceEvent\n    inlines = (AttendeeInline, RuleBundleInline)\n\nclass AttendeeAdmin(admin.ModelAdmin):\n    model = Attendee\n    list_display = ('user', 'event')\n\nclass CompanyEventAdmin(admin.ModelAdmin):\n    model = CompanyEvent\n    inlines = (CompanyInline,)\n\nclass RuleBundleAdmin(admin.ModelAdmin):\n    model = RuleBundle\n   \nclass FieldOfStudyRuleAdmin(admin.ModelAdmin):\n    model = FieldOfStudyRule\n\nclass GradeRuleAdmin(admin.ModelAdmin):\n    model = GradeRule\n\nclass UserGroupRuleAdmin(admin.ModelAdmin):\n    model = UserGroupRule\n\nclass AttendanceEventInline(admin.StackedInline):\n    model = AttendanceEvent\n    max_num = 1\n    extra = 0\n    filter_horizontal = ('rule_bundles',)\n    \n\nclass EventAdmin(admin.ModelAdmin):\n    inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline)\n    exclude = (\"author\", )\n\n    def save_model(self, request, obj, form, change):\n        if not change:  # created\n            obj.author = request.user\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\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\n\nclass CompanyInline(admin.TabularInline):\n    model = CompanyEvent\n    max_num = 20\n    extra = 0\n\n\nclass RuleBundleInline(admin.TabularInline):\n    model = RuleBundle\n    extra = 1\n    max_num = 20\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')\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\n\nclass EventAdmin(admin.ModelAdmin):\n    inlines = (AttendanceEventInline, FeedbackRelationInline, CompanyInline)\n    exclude = (\"author\", )\n\n    def save_model(self, request, obj, form, change):\n        if not change:  # created\n            obj.author = request.user\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(75)]\n        form.base_fields['ingress'].validators=[validators.MinLengthValidator(100)]\n        form.base_fields['description'].validators=[\n                                                    validators.MinLengthValidator(200),\n                                                    validators.RegexValidator(\"^(?:(?!TBA).)*$\", _(\"Beskrivelsen kan ikke inneholde 'TBA'.\"), \"ulovlig\"),\n                                                    ]\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"}]}