prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Vacancies without partner page on homepage lead to 404 errors
  ### Describe the bug
  The vacancy view on the homepage leads to a 404 for vacancies without partner pages, as it tries to go to that page anyway.
  
  ### How to reproduce
  Steps to reproduce the behaviour:
  1. Create an inactive partner
  2. Create a vacancy with them
  3. Make it appear on the homepage
  4. Click it
  
  ### Expected behaviour
  Going to the vacancy in some way, e.g. on the general vacancy page.
  
  ### Screenshots
  If applicable, add screenshots to help explain your problem.
  
  ### Additional context
  I think I sort of fixed this for the main vacancy list, so we can probably share the code there. (Although I believe that that is currently broken too.)
  
  
  --- 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/partners/templatetags/frontpage_vacancies.py`
  Content:
  ```
  1 from django import template
  2 from django.urls import reverse
  3 
  4 from partners.models import Vacancy
  5 
  6 register = template.Library()
  7 
  8 
  9 @register.inclusion_tag("partners/frontpage_vacancies.html")
  10 def render_frontpage_vacancies():
  11     vacancies = []
  12 
  13     for vacancy in Vacancy.objects.order_by("?")[:6]:
  14         url = "{}#vacancy-{}".format(reverse("partners:vacancies"), vacancy.id)
  15         if vacancy.partner:
  16             url = "{}#vacancy-{}".format(vacancy.partner.get_absolute_url(), vacancy.id)
  17 
  18         vacancies.append(
  19             {
  20                 "title": vacancy.title,
  21                 "company_name": vacancy.get_company_name(),
  22                 "url": url,
  23             }
  24         )
  25 
  26     return {"vacancies": vacancies}
  27
  ```
  --- 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/partners/templatetags/frontpage_vacancies.py b/website/partners/templatetags/frontpage_vacancies.py
  --- a/website/partners/templatetags/frontpage_vacancies.py
  +++ b/website/partners/templatetags/frontpage_vacancies.py
  @@ -12,7 +12,7 @@
   
       for vacancy in Vacancy.objects.order_by("?")[:6]:
           url = "{}#vacancy-{}".format(reverse("partners:vacancies"), vacancy.id)
  -        if vacancy.partner:
  +        if vacancy.partner and vacancy.partner.is_active:
               url = "{}#vacancy-{}".format(vacancy.partner.get_absolute_url(), vacancy.id)
   
           vacancies.append(
  
verification_info: {"golden_diff": "diff --git a/website/partners/templatetags/frontpage_vacancies.py b/website/partners/templatetags/frontpage_vacancies.py\n--- a/website/partners/templatetags/frontpage_vacancies.py\n+++ b/website/partners/templatetags/frontpage_vacancies.py\n@@ -12,7 +12,7 @@\n \n     for vacancy in Vacancy.objects.order_by(\"?\")[:6]:\n         url = \"{}#vacancy-{}\".format(reverse(\"partners:vacancies\"), vacancy.id)\n-        if vacancy.partner:\n+        if vacancy.partner and vacancy.partner.is_active:\n             url = \"{}#vacancy-{}\".format(vacancy.partner.get_absolute_url(), vacancy.id)\n \n         vacancies.append(\n", "issue": "Vacancies without partner page on homepage lead to 404 errors\n### Describe the bug\r\nThe vacancy view on the homepage leads to a 404 for vacancies without partner pages, as it tries to go to that page anyway.\r\n\r\n### How to reproduce\r\nSteps to reproduce the behaviour:\r\n1. Create an inactive partner\r\n2. Create a vacancy with them\r\n3. Make it appear on the homepage\r\n4. Click it\r\n\r\n### Expected behaviour\r\nGoing to the vacancy in some way, e.g. on the general vacancy page.\r\n\r\n### Screenshots\r\nIf applicable, add screenshots to help explain your problem.\r\n\r\n### Additional context\r\nI think I sort of fixed this for the main vacancy list, so we can probably share the code there. (Although I believe that that is currently broken too.)\r\n\n", "before_files": [{"content": "from django import template\nfrom django.urls import reverse\n\nfrom partners.models import Vacancy\n\nregister = template.Library()\n\n\n@register.inclusion_tag(\"partners/frontpage_vacancies.html\")\ndef render_frontpage_vacancies():\n    vacancies = []\n\n    for vacancy in Vacancy.objects.order_by(\"?\")[:6]:\n        url = \"{}#vacancy-{}\".format(reverse(\"partners:vacancies\"), vacancy.id)\n        if vacancy.partner:\n            url = \"{}#vacancy-{}\".format(vacancy.partner.get_absolute_url(), vacancy.id)\n\n        vacancies.append(\n            {\n                \"title\": vacancy.title,\n                \"company_name\": vacancy.get_company_name(),\n                \"url\": url,\n            }\n        )\n\n    return {\"vacancies\": vacancies}\n", "path": "website/partners/templatetags/frontpage_vacancies.py"}], "after_files": [{"content": "from django import template\nfrom django.urls import reverse\n\nfrom partners.models import Vacancy\n\nregister = template.Library()\n\n\n@register.inclusion_tag(\"partners/frontpage_vacancies.html\")\ndef render_frontpage_vacancies():\n    vacancies = []\n\n    for vacancy in Vacancy.objects.order_by(\"?\")[:6]:\n        url = \"{}#vacancy-{}\".format(reverse(\"partners:vacancies\"), vacancy.id)\n        if vacancy.partner and vacancy.partner.is_active:\n            url = \"{}#vacancy-{}\".format(vacancy.partner.get_absolute_url(), vacancy.id)\n\n        vacancies.append(\n            {\n                \"title\": vacancy.title,\n                \"company_name\": vacancy.get_company_name(),\n                \"url\": url,\n            }\n        )\n\n    return {\"vacancies\": vacancies}\n", "path": "website/partners/templatetags/frontpage_vacancies.py"}]}