I want to set up a many to many relationship between two models, Gallery and Image. I would like to be able to sort them in the site admin in order to change the order the images appear in a gallery on the frontend.
Is there anything built into Django which will help me do this?
I don’t want to reinvent the wheel!
Any advice appreciated.
Thanks.
Nothing built-in, no. There’s
order_with_respect_to, but that’s for ForeignKeys and doesn’t really expose any functionality in the admin.A quick Google reveals django-sortedm2m, which I haven’t used but is by Gregor Müllegger, who’s contributed a fair amount to Django, so is likely to be reliable.