prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Links to unpublished sources should not appear on Provenance detail pages
  Example: visit http://206.12.93.196/provenance/3665 (while logged out), click on first link. We get a 403 Forbidden error, since the source is unpublished.
  
  Unpublished sources should not be listed on the Provenance Detail page.
  
  Credit to @zhannaklimanova and her link checker script for catching this bug!
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `django/cantusdb_project/main_app/views/provenance.py`
  Content:
  ```
  1 from django.views.generic import DetailView
  2 from main_app.models import Provenance
  3 
  4 
  5 class ProvenanceDetailView(DetailView):
  6     model = Provenance
  7     context_object_name = "provenance"
  8     template_name = "provenance_detail.html"
  9
  ```
  
  Path: `django/cantusdb_project/main_app/views/century.py`
  Content:
  ```
  1 from django.views.generic import DetailView
  2 from main_app.models import Century, Source
  3 from typing import Any
  4 
  5 
  6 class CenturyDetailView(DetailView):
  7     model = Century
  8     context_object_name = "century"
  9     template_name = "century_detail.html"
  10 
  11     def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
  12         context = super().get_context_data(**kwargs)
  13         century = self.get_object()
  14         user = self.request.user
  15         display_unpublished = user.is_authenticated
  16         sources = Source.objects.filter(century=century)
  17         if not display_unpublished:
  18             sources = sources.filter(published=True)
  19         sources = sources.only("title", "id")
  20         context["sources"] = sources
  21         return context
  22
  ```
  --- 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/django/cantusdb_project/main_app/views/century.py b/django/cantusdb_project/main_app/views/century.py
  --- a/django/cantusdb_project/main_app/views/century.py
  +++ b/django/cantusdb_project/main_app/views/century.py
  @@ -16,6 +16,6 @@
           sources = Source.objects.filter(century=century)
           if not display_unpublished:
               sources = sources.filter(published=True)
  -        sources = sources.only("title", "id")
  +        sources = sources.only("title", "id", "siglum")
           context["sources"] = sources
           return context
  diff --git a/django/cantusdb_project/main_app/views/provenance.py b/django/cantusdb_project/main_app/views/provenance.py
  --- a/django/cantusdb_project/main_app/views/provenance.py
  +++ b/django/cantusdb_project/main_app/views/provenance.py
  @@ -1,8 +1,21 @@
   from django.views.generic import DetailView
  -from main_app.models import Provenance
  +from main_app.models import Provenance, Source
  +from typing import Any
   
   
   class ProvenanceDetailView(DetailView):
       model = Provenance
       context_object_name = "provenance"
       template_name = "provenance_detail.html"
  +
  +    def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
  +        context = super().get_context_data(**kwargs)
  +        provenance = self.get_object()
  +        user = self.request.user
  +        display_unpublished = user.is_authenticated
  +        sources = Source.objects.filter(provenance=provenance)
  +        if not display_unpublished:
  +            sources = sources.filter(published=True)
  +        sources = sources.only("title", "id", "siglum")
  +        context["sources"] = sources
  +        return context
  
verification_info: {"golden_diff": "diff --git a/django/cantusdb_project/main_app/views/century.py b/django/cantusdb_project/main_app/views/century.py\n--- a/django/cantusdb_project/main_app/views/century.py\n+++ b/django/cantusdb_project/main_app/views/century.py\n@@ -16,6 +16,6 @@\n         sources = Source.objects.filter(century=century)\n         if not display_unpublished:\n             sources = sources.filter(published=True)\n-        sources = sources.only(\"title\", \"id\")\n+        sources = sources.only(\"title\", \"id\", \"siglum\")\n         context[\"sources\"] = sources\n         return context\ndiff --git a/django/cantusdb_project/main_app/views/provenance.py b/django/cantusdb_project/main_app/views/provenance.py\n--- a/django/cantusdb_project/main_app/views/provenance.py\n+++ b/django/cantusdb_project/main_app/views/provenance.py\n@@ -1,8 +1,21 @@\n from django.views.generic import DetailView\n-from main_app.models import Provenance\n+from main_app.models import Provenance, Source\n+from typing import Any\n \n \n class ProvenanceDetailView(DetailView):\n     model = Provenance\n     context_object_name = \"provenance\"\n     template_name = \"provenance_detail.html\"\n+\n+    def get_context_data(self, **kwargs: Any) -> dict[str, Any]:\n+        context = super().get_context_data(**kwargs)\n+        provenance = self.get_object()\n+        user = self.request.user\n+        display_unpublished = user.is_authenticated\n+        sources = Source.objects.filter(provenance=provenance)\n+        if not display_unpublished:\n+            sources = sources.filter(published=True)\n+        sources = sources.only(\"title\", \"id\", \"siglum\")\n+        context[\"sources\"] = sources\n+        return context\n", "issue": "Links to unpublished sources should not appear on Provenance detail pages\nExample: visit http://206.12.93.196/provenance/3665 (while logged out), click on first link. We get a 403 Forbidden error, since the source is unpublished.\r\n\r\nUnpublished sources should not be listed on the Provenance Detail page.\r\n\r\nCredit to @zhannaklimanova and her link checker script for catching this bug!\n", "before_files": [{"content": "from django.views.generic import DetailView\nfrom main_app.models import Provenance\n\n\nclass ProvenanceDetailView(DetailView):\n    model = Provenance\n    context_object_name = \"provenance\"\n    template_name = \"provenance_detail.html\"\n", "path": "django/cantusdb_project/main_app/views/provenance.py"}, {"content": "from django.views.generic import DetailView\nfrom main_app.models import Century, Source\nfrom typing import Any\n\n\nclass CenturyDetailView(DetailView):\n    model = Century\n    context_object_name = \"century\"\n    template_name = \"century_detail.html\"\n\n    def get_context_data(self, **kwargs: Any) -> dict[str, Any]:\n        context = super().get_context_data(**kwargs)\n        century = self.get_object()\n        user = self.request.user\n        display_unpublished = user.is_authenticated\n        sources = Source.objects.filter(century=century)\n        if not display_unpublished:\n            sources = sources.filter(published=True)\n        sources = sources.only(\"title\", \"id\")\n        context[\"sources\"] = sources\n        return context\n", "path": "django/cantusdb_project/main_app/views/century.py"}], "after_files": [{"content": "from django.views.generic import DetailView\nfrom main_app.models import Provenance, Source\nfrom typing import Any\n\n\nclass ProvenanceDetailView(DetailView):\n    model = Provenance\n    context_object_name = \"provenance\"\n    template_name = \"provenance_detail.html\"\n\n    def get_context_data(self, **kwargs: Any) -> dict[str, Any]:\n        context = super().get_context_data(**kwargs)\n        provenance = self.get_object()\n        user = self.request.user\n        display_unpublished = user.is_authenticated\n        sources = Source.objects.filter(provenance=provenance)\n        if not display_unpublished:\n            sources = sources.filter(published=True)\n        sources = sources.only(\"title\", \"id\", \"siglum\")\n        context[\"sources\"] = sources\n        return context\n", "path": "django/cantusdb_project/main_app/views/provenance.py"}, {"content": "from django.views.generic import DetailView\nfrom main_app.models import Century, Source\nfrom typing import Any\n\n\nclass CenturyDetailView(DetailView):\n    model = Century\n    context_object_name = \"century\"\n    template_name = \"century_detail.html\"\n\n    def get_context_data(self, **kwargs: Any) -> dict[str, Any]:\n        context = super().get_context_data(**kwargs)\n        century = self.get_object()\n        user = self.request.user\n        display_unpublished = user.is_authenticated\n        sources = Source.objects.filter(century=century)\n        if not display_unpublished:\n            sources = sources.filter(published=True)\n        sources = sources.only(\"title\", \"id\", \"siglum\")\n        context[\"sources\"] = sources\n        return context\n", "path": "django/cantusdb_project/main_app/views/century.py"}]}