Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 error on m2m facet detection #534

Open
simonw opened this issue Jul 3, 2019 · 1 comment
Open

500 error on m2m facet detection #534

simonw opened this issue Jul 3, 2019 · 1 comment
Labels

Comments

@simonw
Copy link
Owner

simonw commented Jul 3, 2019

This may help debug:

diff --git a/datasette/facets.py b/datasette/facets.py
index 76d73e5..07a4034 100644
--- a/datasette/facets.py
+++ b/datasette/facets.py
@@ -499,11 +499,14 @@ class ManyToManyFacet(Facet):
                 "outgoing"
             ]
             if len(other_table_outgoing_foreign_keys) == 2:
-                destination_table = [
-                    t
-                    for t in other_table_outgoing_foreign_keys
-                    if t["other_table"] != self.table
-                ][0]["other_table"]
+                try:
+                    destination_table = [
+                        t
+                        for t in other_table_outgoing_foreign_keys
+                        if t["other_table"] != self.table
+                    ][0]["other_table"]
+                except IndexError:
+                    import pdb; pdb.pm()
                 # Only suggest if it's not selected already
                 if ("_facet_m2m", destination_table) in args:
                     continue
@simonw simonw added the bug label Jul 3, 2019
@simonw simonw pinned this issue Jul 3, 2019
@simonw simonw added this to the Datasette 0.29 milestone Jul 7, 2019
@simonw simonw unpinned this issue Jul 7, 2019
@simonw simonw removed this from the Datasette 0.29 milestone Jul 7, 2019
@simonw
Copy link
Owner Author

simonw commented Jul 7, 2019

Part of #551

@simonw simonw added this to the Datasette 1.0 milestone Jun 6, 2020
@simonw simonw removed this from the Datasette 1.0 milestone Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant