prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Importing a backup made by update_production.sh does not work flawlessly.
  Last week we wanted to do a production update. The json dump file created during that update could not be imported without issues:
  - The dump does not contain the cronjob user, but foreign key references to it. This can not be imported
  - The dump contains data included by django by default (auth, permission, ...). These need to be excluded when importing.
  
  There should be some kind of documentation on what needs to be executed to import this dump back into the database. We should also add some test (could probably just run on travis) that ensures this always works (dump, flush database, migrate, load dump).
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `evap/evaluation/management/commands/dump_testdata.py`
  Content:
  ```
  1 import os
  2 
  3 from django.conf import settings
  4 from django.core.management.base import BaseCommand
  5 from django.core.management import call_command
  6 
  7 
  8 class Command(BaseCommand):
  9     args = ''
  10     help = 'Dumps all relevant contents of the database into test_data.json.'
  11     requires_migrations_checks = True
  12 
  13     def handle(self, *args, **options):
  14         outfile_name = os.path.join(settings.BASE_DIR, "evaluation", "fixtures", "test_data.json")
  15         call_command("dumpdata", "auth.group", "evaluation", "rewards", "grades", indent=2, output=outfile_name)
  16
  ```
  --- 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/evap/evaluation/management/commands/dump_testdata.py b/evap/evaluation/management/commands/dump_testdata.py
  --- a/evap/evaluation/management/commands/dump_testdata.py
  +++ b/evap/evaluation/management/commands/dump_testdata.py
  @@ -12,4 +12,6 @@
   
       def handle(self, *args, **options):
           outfile_name = os.path.join(settings.BASE_DIR, "evaluation", "fixtures", "test_data.json")
  -        call_command("dumpdata", "auth.group", "evaluation", "rewards", "grades", indent=2, output=outfile_name)
  +        call_command(
  +            "dumpdata", "auth.group", "evaluation", "rewards", "grades", indent=2,
  +            output=outfile_name, natural_foreign=True, natural_primary=True)
  
verification_info: {"golden_diff": "diff --git a/evap/evaluation/management/commands/dump_testdata.py b/evap/evaluation/management/commands/dump_testdata.py\n--- a/evap/evaluation/management/commands/dump_testdata.py\n+++ b/evap/evaluation/management/commands/dump_testdata.py\n@@ -12,4 +12,6 @@\n \n     def handle(self, *args, **options):\n         outfile_name = os.path.join(settings.BASE_DIR, \"evaluation\", \"fixtures\", \"test_data.json\")\n-        call_command(\"dumpdata\", \"auth.group\", \"evaluation\", \"rewards\", \"grades\", indent=2, output=outfile_name)\n+        call_command(\n+            \"dumpdata\", \"auth.group\", \"evaluation\", \"rewards\", \"grades\", indent=2,\n+            output=outfile_name, natural_foreign=True, natural_primary=True)\n", "issue": "Importing a backup made by update_production.sh does not work flawlessly.\nLast week we wanted to do a production update. The json dump file created during that update could not be imported without issues:\r\n- The dump does not contain the cronjob user, but foreign key references to it. This can not be imported\r\n- The dump contains data included by django by default (auth, permission, ...). These need to be excluded when importing.\r\n\r\nThere should be some kind of documentation on what needs to be executed to import this dump back into the database. We should also add some test (could probably just run on travis) that ensures this always works (dump, flush database, migrate, load dump).\n", "before_files": [{"content": "import os\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand\nfrom django.core.management import call_command\n\n\nclass Command(BaseCommand):\n    args = ''\n    help = 'Dumps all relevant contents of the database into test_data.json.'\n    requires_migrations_checks = True\n\n    def handle(self, *args, **options):\n        outfile_name = os.path.join(settings.BASE_DIR, \"evaluation\", \"fixtures\", \"test_data.json\")\n        call_command(\"dumpdata\", \"auth.group\", \"evaluation\", \"rewards\", \"grades\", indent=2, output=outfile_name)\n", "path": "evap/evaluation/management/commands/dump_testdata.py"}], "after_files": [{"content": "import os\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand\nfrom django.core.management import call_command\n\n\nclass Command(BaseCommand):\n    args = ''\n    help = 'Dumps all relevant contents of the database into test_data.json.'\n    requires_migrations_checks = True\n\n    def handle(self, *args, **options):\n        outfile_name = os.path.join(settings.BASE_DIR, \"evaluation\", \"fixtures\", \"test_data.json\")\n        call_command(\n            \"dumpdata\", \"auth.group\", \"evaluation\", \"rewards\", \"grades\", indent=2,\n            output=outfile_name, natural_foreign=True, natural_primary=True)\n", "path": "evap/evaluation/management/commands/dump_testdata.py"}]}