prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Paparazcie committee members cannot edit promo requests
  Members of the paparazcie cannot edit the promo requests in the back-end. I can, so it might be an issue with permissions. 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `website/promotion/admin.py`
  Content:
  ```
  1 """Registers admin interfaces for the models defined in this module."""
  2 from django.contrib import admin
  3 from django.contrib.admin import ModelAdmin
  4 
  5 from events.services import is_organiser
  6 from promotion.forms import PromotionRequestForm
  7 
  8 from .models import PromotionChannel, PromotionRequest
  9 
  10 
  11 @admin.register(PromotionRequest)
  12 class PromotionRequestAdmin(admin.ModelAdmin):
  13     """This manages the admin interface for the model items."""
  14 
  15     list_display = ("event", "publish_date", "channel", "assigned_to", "status")
  16     list_filter = (
  17         "publish_date",
  18         "assigned_to",
  19         "status",
  20     )
  21     date_hierarchy = "publish_date"
  22     form = PromotionRequestForm
  23     actions = ["mark_not_started", "mark_started", "mark_finished", "mark_published"]
  24 
  25     def has_change_permission(self, request, obj=None):
  26         if obj is not None and not is_organiser(request.member, obj.event):
  27             return False
  28         return super().has_change_permission(request, obj)
  29 
  30     def mark_not_started(self, request, queryset):
  31         """Change the status of the event to published."""
  32         self._change_published(queryset, PromotionRequest.NOT_STARTED)
  33 
  34     mark_not_started.short_description = "Mark requests as not started"
  35 
  36     def mark_started(self, request, queryset):
  37         """Change the status of the event to published."""
  38         self._change_published(queryset, PromotionRequest.STARTED)
  39 
  40     mark_started.short_description = "Mark requests as started"
  41 
  42     def mark_finished(self, request, queryset):
  43         """Change the status of the event to published."""
  44         self._change_published(queryset, PromotionRequest.FINISHED)
  45 
  46     mark_finished.short_description = "Mark requests as finished"
  47 
  48     def mark_published(self, request, queryset):
  49         """Change the status of the event to published."""
  50         self._change_published(queryset, PromotionRequest.PUBLISHED)
  51 
  52     mark_published.short_description = "Mark requests as published"
  53 
  54     @staticmethod
  55     def _change_published(queryset, status):
  56         queryset.update(status=status)
  57 
  58 
  59 @admin.register(PromotionChannel)
  60 class PromotionChannelAdmin(ModelAdmin):
  61     pass
  62
  ```
  --- 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/website/promotion/admin.py b/website/promotion/admin.py
  --- a/website/promotion/admin.py
  +++ b/website/promotion/admin.py
  @@ -23,8 +23,8 @@
       actions = ["mark_not_started", "mark_started", "mark_finished", "mark_published"]
   
       def has_change_permission(self, request, obj=None):
  -        if obj is not None and not is_organiser(request.member, obj.event):
  -            return False
  +        if obj is not None and obj.event and is_organiser(request.member, obj.event):
  +            return True
           return super().has_change_permission(request, obj)
   
       def mark_not_started(self, request, queryset):
  
verification_info: {"golden_diff": "diff --git a/website/promotion/admin.py b/website/promotion/admin.py\n--- a/website/promotion/admin.py\n+++ b/website/promotion/admin.py\n@@ -23,8 +23,8 @@\n     actions = [\"mark_not_started\", \"mark_started\", \"mark_finished\", \"mark_published\"]\n \n     def has_change_permission(self, request, obj=None):\n-        if obj is not None and not is_organiser(request.member, obj.event):\n-            return False\n+        if obj is not None and obj.event and is_organiser(request.member, obj.event):\n+            return True\n         return super().has_change_permission(request, obj)\n \n     def mark_not_started(self, request, queryset):\n", "issue": "Paparazcie committee members cannot edit promo requests\nMembers of the paparazcie cannot edit the promo requests in the back-end. I can, so it might be an issue with permissions. \n", "before_files": [{"content": "\"\"\"Registers admin interfaces for the models defined in this module.\"\"\"\nfrom django.contrib import admin\nfrom django.contrib.admin import ModelAdmin\n\nfrom events.services import is_organiser\nfrom promotion.forms import PromotionRequestForm\n\nfrom .models import PromotionChannel, PromotionRequest\n\n\n@admin.register(PromotionRequest)\nclass PromotionRequestAdmin(admin.ModelAdmin):\n    \"\"\"This manages the admin interface for the model items.\"\"\"\n\n    list_display = (\"event\", \"publish_date\", \"channel\", \"assigned_to\", \"status\")\n    list_filter = (\n        \"publish_date\",\n        \"assigned_to\",\n        \"status\",\n    )\n    date_hierarchy = \"publish_date\"\n    form = PromotionRequestForm\n    actions = [\"mark_not_started\", \"mark_started\", \"mark_finished\", \"mark_published\"]\n\n    def has_change_permission(self, request, obj=None):\n        if obj is not None and not is_organiser(request.member, obj.event):\n            return False\n        return super().has_change_permission(request, obj)\n\n    def mark_not_started(self, request, queryset):\n        \"\"\"Change the status of the event to published.\"\"\"\n        self._change_published(queryset, PromotionRequest.NOT_STARTED)\n\n    mark_not_started.short_description = \"Mark requests as not started\"\n\n    def mark_started(self, request, queryset):\n        \"\"\"Change the status of the event to published.\"\"\"\n        self._change_published(queryset, PromotionRequest.STARTED)\n\n    mark_started.short_description = \"Mark requests as started\"\n\n    def mark_finished(self, request, queryset):\n        \"\"\"Change the status of the event to published.\"\"\"\n        self._change_published(queryset, PromotionRequest.FINISHED)\n\n    mark_finished.short_description = \"Mark requests as finished\"\n\n    def mark_published(self, request, queryset):\n        \"\"\"Change the status of the event to published.\"\"\"\n        self._change_published(queryset, PromotionRequest.PUBLISHED)\n\n    mark_published.short_description = \"Mark requests as published\"\n\n    @staticmethod\n    def _change_published(queryset, status):\n        queryset.update(status=status)\n\n\n@admin.register(PromotionChannel)\nclass PromotionChannelAdmin(ModelAdmin):\n    pass\n", "path": "website/promotion/admin.py"}], "after_files": [{"content": "\"\"\"Registers admin interfaces for the models defined in this module.\"\"\"\nfrom django.contrib import admin\nfrom django.contrib.admin import ModelAdmin\n\nfrom events.services import is_organiser\nfrom promotion.forms import PromotionRequestForm\n\nfrom .models import PromotionChannel, PromotionRequest\n\n\n@admin.register(PromotionRequest)\nclass PromotionRequestAdmin(admin.ModelAdmin):\n    \"\"\"This manages the admin interface for the model items.\"\"\"\n\n    list_display = (\"event\", \"publish_date\", \"channel\", \"assigned_to\", \"status\")\n    list_filter = (\n        \"publish_date\",\n        \"assigned_to\",\n        \"status\",\n    )\n    date_hierarchy = \"publish_date\"\n    form = PromotionRequestForm\n    actions = [\"mark_not_started\", \"mark_started\", \"mark_finished\", \"mark_published\"]\n\n    def has_change_permission(self, request, obj=None):\n        if obj is not None and obj.event and is_organiser(request.member, obj.event):\n            return True\n        return super().has_change_permission(request, obj)\n\n    def mark_not_started(self, request, queryset):\n        \"\"\"Change the status of the event to published.\"\"\"\n        self._change_published(queryset, PromotionRequest.NOT_STARTED)\n\n    mark_not_started.short_description = \"Mark requests as not started\"\n\n    def mark_started(self, request, queryset):\n        \"\"\"Change the status of the event to published.\"\"\"\n        self._change_published(queryset, PromotionRequest.STARTED)\n\n    mark_started.short_description = \"Mark requests as started\"\n\n    def mark_finished(self, request, queryset):\n        \"\"\"Change the status of the event to published.\"\"\"\n        self._change_published(queryset, PromotionRequest.FINISHED)\n\n    mark_finished.short_description = \"Mark requests as finished\"\n\n    def mark_published(self, request, queryset):\n        \"\"\"Change the status of the event to published.\"\"\"\n        self._change_published(queryset, PromotionRequest.PUBLISHED)\n\n    mark_published.short_description = \"Mark requests as published\"\n\n    @staticmethod\n    def _change_published(queryset, status):\n        queryset.update(status=status)\n\n\n@admin.register(PromotionChannel)\nclass PromotionChannelAdmin(ModelAdmin):\n    pass\n", "path": "website/promotion/admin.py"}]}