Reputation: 2501
I have a question about how to design a django model. Here is the problem. I have one model, which is a table of URLs that can be submitted to my app. I also, through a many to many relationship, have made the ability to combine the URLs into 'collections'. This works just fine however, I would like to add the ability to order and reorder the links in a collection. So for example, the list of links id [a,b,c,d]. User1 creates a collection of [d,a,c], while User2 creates a collection of [a,c,d], and User3 creates a collection of [c,d,b]. Is there a simple way to add this functionality with my current design?
I am using python3, django1.8 and postgres, if that matters at all.
Thanks in advance.
Upvotes: 0
Views: 81
Reputation: 5443
You can make a ManyToManyField connect via an intermediary model. This model can control the sorting of the entries. Take a look at for example this question and answer: Django ManyToManyField ordering using through?.
Upvotes: 1