mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Sort databases on homepage by argument order - #591
Closes #585 - thanks, @rixx!
This commit is contained in:
parent
cd1b22f100
commit
2ad1f0d34e
3 changed files with 3 additions and 5 deletions
|
|
@ -159,7 +159,7 @@ class Datasette:
|
|||
self.files = [MEMORY]
|
||||
elif memory:
|
||||
self.files = (MEMORY,) + self.files
|
||||
self.databases = {}
|
||||
self.databases = collections.OrderedDict()
|
||||
self.inspect_data = inspect_data
|
||||
for file in self.files:
|
||||
path = file
|
||||
|
|
|
|||
|
|
@ -97,8 +97,6 @@ class IndexView(BaseView):
|
|||
}
|
||||
)
|
||||
|
||||
databases.sort(key=lambda database: database["name"])
|
||||
|
||||
if as_format:
|
||||
headers = {}
|
||||
if self.ds.cors:
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ def test_homepage(app_client_two_attached_databases):
|
|||
)
|
||||
# Should be two attached databases
|
||||
assert [
|
||||
{"href": "/extra_database", "text": "extra_database"},
|
||||
{"href": "/fixtures", "text": "fixtures"},
|
||||
{"href": "/extra_database", "text": "extra_database"},
|
||||
] == [{"href": a["href"], "text": a.text.strip()} for a in soup.select("h2 a")]
|
||||
# The first attached database should show count text and attached tables
|
||||
h2 = soup.select("h2")[0]
|
||||
h2 = soup.select("h2")[1]
|
||||
assert "extra_database" == h2.text.strip()
|
||||
counts_p, links_p = h2.find_all_next("p")[:2]
|
||||
assert (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue