Suppose you have a many-to-many relation in a Django model, such as:
class GroceryList(models.Model):
items = models.ManyToManyField(GroceryItem, related_name='in_lists')
class GroceryItem(models.Model):
name = models.CharField(unique=True)
You and me can both have the same items in two different lists, such as Avocado
, and they will point to the same Avocado
object.
What is the best way to implement an arbitrary order for items in each list, that can be edited separately for each list? (i.e. I have Avocado
first in my list, while you have it at index 4
)
django-ordered-model seems like an interesting solution, but it assumes global order across all objects.