Many to Many Fields #44
Replies: 5 comments 10 replies
-
@dantownsend I haven’t seen so far that we’ve had Discussions. That's great. |
Beta Was this translation helpful? Give feedback.
-
One thing I do like about Django's M2M field, is it provides a widget like this in the admin: I'd like to do something similar to this in the Piccolo admin. |
Beta Was this translation helpful? Give feedback.
-
I like Django's approach: If you have a really simple M2M relationship that just requires a table with 2 foreign keys, it creates it for you. Nobody really wants to have to do that manually. However, it also allows you to define a through model to define a M2M with extra fields on it. This way you still get the nice autogenerated accessors (not needing to implement |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, Sorry for digging this old discussion up but I have a question that you can hopefully help me with. I understand the concept of creating the joining table as given in the example at the top, and the Thanks for all the work with Piccolo so far; I'm really impressed with how intuitive so much of it is. |
Beta Was this translation helpful? Give feedback.
-
We now have proper M2M support in Piccolo: https://piccolo-orm.readthedocs.io/en/latest/piccolo/schema/m2m.html |
Beta Was this translation helpful? Give feedback.
-
Some ORMs don't support M2M fields (e.g. Peewee), as it involves the ORM creating extra tables under the hood. It adds quite a bit of magic.
On the other side, some ORMs (such as Django's) have M2M fields. By having M2M fields explicitly supported in the ORM, it is beneficial for tooling such as the admin, as custom widgets can be displayed.
Currently, I just create a joining table explicitly:
I'm interested to here people's thoughts on M2M fields.
Beta Was this translation helpful? Give feedback.
All reactions