2

I have a standard many-to-many table design with 'hosting' and 'months' connected by 'hosting-months'. In Directus 8 interface I set this up as:

enter image description here

I've tried multiple display settings, with the table name and without in dot (Twig?) format. {{months.id}} - {{months.month}} and {{id}} - {{month}} However, whatever I try, when editing record in the collections view, it says No items selected (what I would expect if table is empty), but Add New and Select Existing are both empty.

enter image description here

and

enter image description here

In the end I just want to be able to assign multiple months here, such as January, April, July etc, and it seems like this is what it's designed to do. However I can't get any values to assign. And yes, my 'hosting' and 'months' table both have data.

DB structure is:

tbl hosting
-id
-domain
-cycle_start (not to store data, but seems like this is needed as field for many-to-many field in directus)

tbl months
-id
-month

tbl hosting_months
-id
-month_id
-hosting_id

1 Answers1

1

The display template is executed on the junction table, so you have to go a level "deeper". Try {{month_id.id}} - {{month_id.month}} instead.

Rijk
  • 939
  • 7
  • 17
  • 1
    Tried this, thanks, but it's still blank. I just added my db table structure to the end of my question above. Something I'm just missing. The collection I want the many-to-many in is the hosting table. I'm not sure what to expect from the interface also, the add new and add existing are a little confusing. Are there any working examples out there? – user3525484 Mar 28 '20 at 02:31