We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Invalid model identifier
https://github.com/CTFd/CTFd/blob/master/CTFd/themes/core/templates/scoreboard.html#L26

This should change depending on the mode of the CTF

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `CTFd/plugins/__init__.py`
Content:
```
1 import glob
2 import importlib
3 import os
4 from collections import namedtuple
5 
6 from flask import current_app as app
7 from flask import send_file, send_from_directory, url_for
8 
9 from CTFd.utils.config.pages import get_pages
10 from CTFd.utils.decorators import admins_only as admins_only_wrapper
11 from CTFd.utils.plugins import override_template as utils_override_template
12 from CTFd.utils.plugins import (
13     register_admin_script as utils_register_admin_plugin_script,
14 )
15 from CTFd.utils.plugins import (
16     register_admin_stylesheet as utils_register_admin_plugin_stylesheet,
17 )
18 from CTFd.utils.plugins import register_script as utils_register_plugin_script
19 from CTFd.utils.plugins import register_stylesheet as utils_register_plugin_stylesheet
20 
21 Menu = namedtuple("Menu", ["title", "route"])
22 
23 
24 def register_plugin_assets_directory(app, base_path, admins_only=False, endpoint=None):
25     """
26     Registers a directory to serve assets
27 
28     :param app: A CTFd application
29     :param string base_path: The path to the directory
30     :param boolean admins_only: Whether or not the assets served out of the directory should be accessible to the public
31     :return:
32     """
33     base_path = base_path.strip("/")
34     if endpoint is None:
35         endpoint = base_path.replace("/", ".")
36 
37     def assets_handler(path):
38         return send_from_directory(base_path, path)
39 
40     rule = "/" + base_path + "/<path:path>"
41     app.add_url_rule(rule=rule, endpoint=endpoint, view_func=assets_handler)
42 
43 
44 def register_plugin_asset(app, asset_path, admins_only=False, endpoint=None):
45     """
46     Registers an file path to be served by CTFd
47 
48     :param app: A CTFd application
49     :param string asset_path: The path to the asset file
50     :param boolean admins_only: Whether or not this file should be accessible to the public
51     :return:
52     """
53     asset_path = asset_path.strip("/")
54     if endpoint is None:
55         endpoint = asset_path.replace("/", ".")
56 
57     def asset_handler():
58         return send_file(asset_path)
59 
60     if admins_only:
61         asset_handler = admins_only_wrapper(asset_handler)
62     rule = "/" + asset_path
63     app.add_url_rule(rule=rule, endpoint=endpoint, view_func=asset_handler)
64 
65 
66 def override_template(*args, **kwargs):
67     """
68     Overrides a template with the provided html content.
69 
70     e.g. override_template('scoreboard.html', '<h1>scores</h1>')
71     """
72     utils_override_template(*args, **kwargs)
73 
74 
75 def register_plugin_script(*args, **kwargs):
76     """
77     Adds a given script to the base.html template which all pages inherit from
78     """
79     utils_register_plugin_script(*args, **kwargs)
80 
81 
82 def register_plugin_stylesheet(*args, **kwargs):
83     """
84     Adds a given stylesheet to the base.html template which all pages inherit from.
85     """
86     utils_register_plugin_stylesheet(*args, **kwargs)
87 
88 
89 def register_admin_plugin_script(*args, **kwargs):
90     """
91     Adds a given script to the base.html of the admin theme which all admin pages inherit from
92     :param args:
93     :param kwargs:
94     :return:
95     """
96     utils_register_admin_plugin_script(*args, **kwargs)
97 
98 
99 def register_admin_plugin_stylesheet(*args, **kwargs):
100     """
101     Adds a given stylesheet to the base.html of the admin theme which all admin pages inherit from
102     :param args:
103     :param kwargs:
104     :return:
105     """
106     utils_register_admin_plugin_stylesheet(*args, **kwargs)
107 
108 
109 def register_admin_plugin_menu_bar(title, route):
110     """
111     Registers links on the Admin Panel menubar/navbar
112 
113     :param name: A string that is shown on the navbar HTML
114     :param route: A string that is the href used by the link
115     :return:
116     """
117     am = Menu(title=title, route=route)
118     app.admin_plugin_menu_bar.append(am)
119 
120 
121 def get_admin_plugin_menu_bar():
122     """
123     Access the list used to store the plugin menu bar
124 
125     :return: Returns a list of Menu namedtuples. They have name, and route attributes.
126     """
127     return app.admin_plugin_menu_bar
128 
129 
130 def register_user_page_menu_bar(title, route):
131     """
132     Registers links on the User side menubar/navbar
133 
134     :param name: A string that is shown on the navbar HTML
135     :param route: A string that is the href used by the link
136     :return:
137     """
138     p = Menu(title=title, route=route)
139     app.plugin_menu_bar.append(p)
140 
141 
142 def get_user_page_menu_bar():
143     """
144     Access the list used to store the user page menu bar
145 
146     :return: Returns a list of Menu namedtuples. They have name, and route attributes.
147     """
148     pages = []
149     for p in get_pages() + app.plugin_menu_bar:
150         if p.route.startswith("http"):
151             route = p.route
152         else:
153             route = url_for("views.static_html", route=p.route)
154             print(route)
155         pages.append(Menu(title=p.title, route=route))
156     return pages
157 
158 
159 def bypass_csrf_protection(f):
160     """
161     Decorator that allows a route to bypass the need for a CSRF nonce on POST requests.
162 
163     This should be considered beta and may change in future versions.
164 
165     :param f: A function that needs to bypass CSRF protection
166     :return: Returns a function with the _bypass_csrf attribute set which tells CTFd to not require CSRF protection.
167     """
168     f._bypass_csrf = True
169     return f
170 
171 
172 def get_plugin_names():
173     modules = sorted(glob.glob(app.plugins_dir + "/*"))
174     blacklist = {"__pycache__"}
175     plugins = []
176     for module in modules:
177         module_name = os.path.basename(module)
178         if os.path.isdir(module) and module_name not in blacklist:
179             plugins.append(module_name)
180     return plugins
181 
182 
183 def init_plugins(app):
184     """
185     Searches for the load function in modules in the CTFd/plugins folder. This function is called with the current CTFd
186     app as a parameter. This allows CTFd plugins to modify CTFd's behavior.
187 
188     :param app: A CTFd application
189     :return:
190     """
191     app.admin_plugin_scripts = []
192     app.admin_plugin_stylesheets = []
193     app.plugin_scripts = []
194     app.plugin_stylesheets = []
195 
196     app.admin_plugin_menu_bar = []
197     app.plugin_menu_bar = []
198     app.plugins_dir = os.path.dirname(__file__)
199 
200     if app.config.get("SAFE_MODE", False) is False:
201         for plugin in get_plugin_names():
202             module = "." + plugin
203             module = importlib.import_module(module, package="CTFd.plugins")
204             module.load(app)
205             print(" * Loaded module, %s" % module)
206 
207     app.jinja_env.globals.update(get_admin_plugin_menu_bar=get_admin_plugin_menu_bar)
208     app.jinja_env.globals.update(get_user_page_menu_bar=get_user_page_menu_bar)
209
```
--- 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()

```

diff --git a/CTFd/plugins/__init__.py b/CTFd/plugins/__init__.py
--- a/CTFd/plugins/__init__.py
+++ b/CTFd/plugins/__init__.py
@@ -151,7 +151,6 @@
             route = p.route
         else:
             route = url_for("views.static_html", route=p.route)
-            print(route)
         pages.append(Menu(title=p.title, route=route))
     return pages

{"golden_diff": "diff --git a/CTFd/plugins/__init__.py b/CTFd/plugins/__init__.py\n--- a/CTFd/plugins/__init__.py\n+++ b/CTFd/plugins/__init__.py\n@@ -151,7 +151,6 @@\n             route = p.route\n         else:\n             route = url_for(\"views.static_html\", route=p.route)\n-            print(route)\n         pages.append(Menu(title=p.title, route=route))\n     return pages\n", "issue": "Invalid model identifier\nhttps://github.com/CTFd/CTFd/blob/master/CTFd/themes/core/templates/scoreboard.html#L26\r\n\r\nThis should change depending on the mode of the CTF\n", "before_files": [{"content": "import glob\nimport importlib\nimport os\nfrom collections import namedtuple\n\nfrom flask import current_app as app\nfrom flask import send_file, send_from_directory, url_for\n\nfrom CTFd.utils.config.pages import get_pages\nfrom CTFd.utils.decorators import admins_only as admins_only_wrapper\nfrom CTFd.utils.plugins import override_template as utils_override_template\nfrom CTFd.utils.plugins import (\n    register_admin_script as utils_register_admin_plugin_script,\n)\nfrom CTFd.utils.plugins import (\n    register_admin_stylesheet as utils_register_admin_plugin_stylesheet,\n)\nfrom CTFd.utils.plugins import register_script as utils_register_plugin_script\nfrom CTFd.utils.plugins import register_stylesheet as utils_register_plugin_stylesheet\n\nMenu = namedtuple(\"Menu\", [\"title\", \"route\"])\n\n\ndef register_plugin_assets_directory(app, base_path, admins_only=False, endpoint=None):\n    \"\"\"\n    Registers a directory to serve assets\n\n    :param app: A CTFd application\n    :param string base_path: The path to the directory\n    :param boolean admins_only: Whether or not the assets served out of the directory should be accessible to the public\n    :return:\n    \"\"\"\n    base_path = base_path.strip(\"/\")\n    if endpoint is None:\n        endpoint = base_path.replace(\"/\", \".\")\n\n    def assets_handler(path):\n        return send_from_directory(base_path, path)\n\n    rule = \"/\" + base_path + \"/<path:path>\"\n    app.add_url_rule(rule=rule, endpoint=endpoint, view_func=assets_handler)\n\n\ndef register_plugin_asset(app, asset_path, admins_only=False, endpoint=None):\n    \"\"\"\n    Registers an file path to be served by CTFd\n\n    :param app: A CTFd application\n    :param string asset_path: The path to the asset file\n    :param boolean admins_only: Whether or not this file should be accessible to the public\n    :return:\n    \"\"\"\n    asset_path = asset_path.strip(\"/\")\n    if endpoint is None:\n        endpoint = asset_path.replace(\"/\", \".\")\n\n    def asset_handler():\n        return send_file(asset_path)\n\n    if admins_only:\n        asset_handler = admins_only_wrapper(asset_handler)\n    rule = \"/\" + asset_path\n    app.add_url_rule(rule=rule, endpoint=endpoint, view_func=asset_handler)\n\n\ndef override_template(*args, **kwargs):\n    \"\"\"\n    Overrides a template with the provided html content.\n\n    e.g. override_template('scoreboard.html', '<h1>scores</h1>')\n    \"\"\"\n    utils_override_template(*args, **kwargs)\n\n\ndef register_plugin_script(*args, **kwargs):\n    \"\"\"\n    Adds a given script to the base.html template which all pages inherit from\n    \"\"\"\n    utils_register_plugin_script(*args, **kwargs)\n\n\ndef register_plugin_stylesheet(*args, **kwargs):\n    \"\"\"\n    Adds a given stylesheet to the base.html template which all pages inherit from.\n    \"\"\"\n    utils_register_plugin_stylesheet(*args, **kwargs)\n\n\ndef register_admin_plugin_script(*args, **kwargs):\n    \"\"\"\n    Adds a given script to the base.html of the admin theme which all admin pages inherit from\n    :param args:\n    :param kwargs:\n    :return:\n    \"\"\"\n    utils_register_admin_plugin_script(*args, **kwargs)\n\n\ndef register_admin_plugin_stylesheet(*args, **kwargs):\n    \"\"\"\n    Adds a given stylesheet to the base.html of the admin theme which all admin pages inherit from\n    :param args:\n    :param kwargs:\n    :return:\n    \"\"\"\n    utils_register_admin_plugin_stylesheet(*args, **kwargs)\n\n\ndef register_admin_plugin_menu_bar(title, route):\n    \"\"\"\n    Registers links on the Admin Panel menubar/navbar\n\n    :param name: A string that is shown on the navbar HTML\n    :param route: A string that is the href used by the link\n    :return:\n    \"\"\"\n    am = Menu(title=title, route=route)\n    app.admin_plugin_menu_bar.append(am)\n\n\ndef get_admin_plugin_menu_bar():\n    \"\"\"\n    Access the list used to store the plugin menu bar\n\n    :return: Returns a list of Menu namedtuples. They have name, and route attributes.\n    \"\"\"\n    return app.admin_plugin_menu_bar\n\n\ndef register_user_page_menu_bar(title, route):\n    \"\"\"\n    Registers links on the User side menubar/navbar\n\n    :param name: A string that is shown on the navbar HTML\n    :param route: A string that is the href used by the link\n    :return:\n    \"\"\"\n    p = Menu(title=title, route=route)\n    app.plugin_menu_bar.append(p)\n\n\ndef get_user_page_menu_bar():\n    \"\"\"\n    Access the list used to store the user page menu bar\n\n    :return: Returns a list of Menu namedtuples. They have name, and route attributes.\n    \"\"\"\n    pages = []\n    for p in get_pages() + app.plugin_menu_bar:\n        if p.route.startswith(\"http\"):\n            route = p.route\n        else:\n            route = url_for(\"views.static_html\", route=p.route)\n            print(route)\n        pages.append(Menu(title=p.title, route=route))\n    return pages\n\n\ndef bypass_csrf_protection(f):\n    \"\"\"\n    Decorator that allows a route to bypass the need for a CSRF nonce on POST requests.\n\n    This should be considered beta and may change in future versions.\n\n    :param f: A function that needs to bypass CSRF protection\n    :return: Returns a function with the _bypass_csrf attribute set which tells CTFd to not require CSRF protection.\n    \"\"\"\n    f._bypass_csrf = True\n    return f\n\n\ndef get_plugin_names():\n    modules = sorted(glob.glob(app.plugins_dir + \"/*\"))\n    blacklist = {\"__pycache__\"}\n    plugins = []\n    for module in modules:\n        module_name = os.path.basename(module)\n        if os.path.isdir(module) and module_name not in blacklist:\n            plugins.append(module_name)\n    return plugins\n\n\ndef init_plugins(app):\n    \"\"\"\n    Searches for the load function in modules in the CTFd/plugins folder. This function is called with the current CTFd\n    app as a parameter. This allows CTFd plugins to modify CTFd's behavior.\n\n    :param app: A CTFd application\n    :return:\n    \"\"\"\n    app.admin_plugin_scripts = []\n    app.admin_plugin_stylesheets = []\n    app.plugin_scripts = []\n    app.plugin_stylesheets = []\n\n    app.admin_plugin_menu_bar = []\n    app.plugin_menu_bar = []\n    app.plugins_dir = os.path.dirname(__file__)\n\n    if app.config.get(\"SAFE_MODE\", False) is False:\n        for plugin in get_plugin_names():\n            module = \".\" + plugin\n            module = importlib.import_module(module, package=\"CTFd.plugins\")\n            module.load(app)\n            print(\" * Loaded module, %s\" % module)\n\n    app.jinja_env.globals.update(get_admin_plugin_menu_bar=get_admin_plugin_menu_bar)\n    app.jinja_env.globals.update(get_user_page_menu_bar=get_user_page_menu_bar)\n", "path": "CTFd/plugins/__init__.py"}], "after_files": [{"content": "import glob\nimport importlib\nimport os\nfrom collections import namedtuple\n\nfrom flask import current_app as app\nfrom flask import send_file, send_from_directory, url_for\n\nfrom CTFd.utils.config.pages import get_pages\nfrom CTFd.utils.decorators import admins_only as admins_only_wrapper\nfrom CTFd.utils.plugins import override_template as utils_override_template\nfrom CTFd.utils.plugins import (\n    register_admin_script as utils_register_admin_plugin_script,\n)\nfrom CTFd.utils.plugins import (\n    register_admin_stylesheet as utils_register_admin_plugin_stylesheet,\n)\nfrom CTFd.utils.plugins import register_script as utils_register_plugin_script\nfrom CTFd.utils.plugins import register_stylesheet as utils_register_plugin_stylesheet\n\nMenu = namedtuple(\"Menu\", [\"title\", \"route\"])\n\n\ndef register_plugin_assets_directory(app, base_path, admins_only=False, endpoint=None):\n    \"\"\"\n    Registers a directory to serve assets\n\n    :param app: A CTFd application\n    :param string base_path: The path to the directory\n    :param boolean admins_only: Whether or not the assets served out of the directory should be accessible to the public\n    :return:\n    \"\"\"\n    base_path = base_path.strip(\"/\")\n    if endpoint is None:\n        endpoint = base_path.replace(\"/\", \".\")\n\n    def assets_handler(path):\n        return send_from_directory(base_path, path)\n\n    rule = \"/\" + base_path + \"/<path:path>\"\n    app.add_url_rule(rule=rule, endpoint=endpoint, view_func=assets_handler)\n\n\ndef register_plugin_asset(app, asset_path, admins_only=False, endpoint=None):\n    \"\"\"\n    Registers an file path to be served by CTFd\n\n    :param app: A CTFd application\n    :param string asset_path: The path to the asset file\n    :param boolean admins_only: Whether or not this file should be accessible to the public\n    :return:\n    \"\"\"\n    asset_path = asset_path.strip(\"/\")\n    if endpoint is None:\n        endpoint = asset_path.replace(\"/\", \".\")\n\n    def asset_handler():\n        return send_file(asset_path)\n\n    if admins_only:\n        asset_handler = admins_only_wrapper(asset_handler)\n    rule = \"/\" + asset_path\n    app.add_url_rule(rule=rule, endpoint=endpoint, view_func=asset_handler)\n\n\ndef override_template(*args, **kwargs):\n    \"\"\"\n    Overrides a template with the provided html content.\n\n    e.g. override_template('scoreboard.html', '<h1>scores</h1>')\n    \"\"\"\n    utils_override_template(*args, **kwargs)\n\n\ndef register_plugin_script(*args, **kwargs):\n    \"\"\"\n    Adds a given script to the base.html template which all pages inherit from\n    \"\"\"\n    utils_register_plugin_script(*args, **kwargs)\n\n\ndef register_plugin_stylesheet(*args, **kwargs):\n    \"\"\"\n    Adds a given stylesheet to the base.html template which all pages inherit from.\n    \"\"\"\n    utils_register_plugin_stylesheet(*args, **kwargs)\n\n\ndef register_admin_plugin_script(*args, **kwargs):\n    \"\"\"\n    Adds a given script to the base.html of the admin theme which all admin pages inherit from\n    :param args:\n    :param kwargs:\n    :return:\n    \"\"\"\n    utils_register_admin_plugin_script(*args, **kwargs)\n\n\ndef register_admin_plugin_stylesheet(*args, **kwargs):\n    \"\"\"\n    Adds a given stylesheet to the base.html of the admin theme which all admin pages inherit from\n    :param args:\n    :param kwargs:\n    :return:\n    \"\"\"\n    utils_register_admin_plugin_stylesheet(*args, **kwargs)\n\n\ndef register_admin_plugin_menu_bar(title, route):\n    \"\"\"\n    Registers links on the Admin Panel menubar/navbar\n\n    :param name: A string that is shown on the navbar HTML\n    :param route: A string that is the href used by the link\n    :return:\n    \"\"\"\n    am = Menu(title=title, route=route)\n    app.admin_plugin_menu_bar.append(am)\n\n\ndef get_admin_plugin_menu_bar():\n    \"\"\"\n    Access the list used to store the plugin menu bar\n\n    :return: Returns a list of Menu namedtuples. They have name, and route attributes.\n    \"\"\"\n    return app.admin_plugin_menu_bar\n\n\ndef register_user_page_menu_bar(title, route):\n    \"\"\"\n    Registers links on the User side menubar/navbar\n\n    :param name: A string that is shown on the navbar HTML\n    :param route: A string that is the href used by the link\n    :return:\n    \"\"\"\n    p = Menu(title=title, route=route)\n    app.plugin_menu_bar.append(p)\n\n\ndef get_user_page_menu_bar():\n    \"\"\"\n    Access the list used to store the user page menu bar\n\n    :return: Returns a list of Menu namedtuples. They have name, and route attributes.\n    \"\"\"\n    pages = []\n    for p in get_pages() + app.plugin_menu_bar:\n        if p.route.startswith(\"http\"):\n            route = p.route\n        else:\n            route = url_for(\"views.static_html\", route=p.route)\n        pages.append(Menu(title=p.title, route=route))\n    return pages\n\n\ndef bypass_csrf_protection(f):\n    \"\"\"\n    Decorator that allows a route to bypass the need for a CSRF nonce on POST requests.\n\n    This should be considered beta and may change in future versions.\n\n    :param f: A function that needs to bypass CSRF protection\n    :return: Returns a function with the _bypass_csrf attribute set which tells CTFd to not require CSRF protection.\n    \"\"\"\n    f._bypass_csrf = True\n    return f\n\n\ndef get_plugin_names():\n    modules = sorted(glob.glob(app.plugins_dir + \"/*\"))\n    blacklist = {\"__pycache__\"}\n    plugins = []\n    for module in modules:\n        module_name = os.path.basename(module)\n        if os.path.isdir(module) and module_name not in blacklist:\n            plugins.append(module_name)\n    return plugins\n\n\ndef init_plugins(app):\n    \"\"\"\n    Searches for the load function in modules in the CTFd/plugins folder. This function is called with the current CTFd\n    app as a parameter. This allows CTFd plugins to modify CTFd's behavior.\n\n    :param app: A CTFd application\n    :return:\n    \"\"\"\n    app.admin_plugin_scripts = []\n    app.admin_plugin_stylesheets = []\n    app.plugin_scripts = []\n    app.plugin_stylesheets = []\n\n    app.admin_plugin_menu_bar = []\n    app.plugin_menu_bar = []\n    app.plugins_dir = os.path.dirname(__file__)\n\n    if app.config.get(\"SAFE_MODE\", False) is False:\n        for plugin in get_plugin_names():\n            module = \".\" + plugin\n            module = importlib.import_module(module, package=\"CTFd.plugins\")\n            module.load(app)\n            print(\" * Loaded module, %s\" % module)\n\n    app.jinja_env.globals.update(get_admin_plugin_menu_bar=get_admin_plugin_menu_bar)\n    app.jinja_env.globals.update(get_user_page_menu_bar=get_user_page_menu_bar)\n", "path": "CTFd/plugins/__init__.py"}]}