gitwtfhub

wtf is django-sortedm2m?

treyhunner/django-sortedm2m — explained in plain English

Analysis updated 2026-07-18 · repo last pushed 2012-10-25

PythonAudience · developerComplexity · 1/5DormantSetup · easy

TL;DR

A Django field that works like a normal many-to-many relationship but remembers the order items were added, ideal for galleries, playlists, or ranked lists.

Mindmap

mindmap
  root((django-sortedm2m))
    What it does
      Ordered many-to-many
      Drop-in replacement
      Remembers add order
    Tech Stack
      Python
      Django
      Admin widget
    Use Cases
      Photo galleries
      Playlists
      Recommended products
    Audience
      Django developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Build a photo gallery where photos display in the exact order they were added.

REASON 2

Create a playlist feature that keeps tracks in the sequence a user arranged them.

REASON 3

Order a list of recommended products without writing custom ordering logic.

REASON 4

Use the drag-and-drop admin widget to reorder related items visually.

What's in the stack?

PythonDjango

How it stacks up

treyhunner/django-sortedm2m0xallam/my-recipe0xhassaan/nn-from-scratch
Stars0
LanguagePythonPythonPython
Last pushed2012-10-252022-11-22
MaintenanceDormantDormant
Setup difficultyeasymoderatemoderate
Complexity1/52/54/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min
The README does not specify license terms.

Yoink these prompts

Prompt 1
Show me how to swap Django's ManyToManyField for SortedManyToManyField in my gallery model.
Prompt 2
Explain how django-sortedm2m keeps track of the order items were added to a relationship.
Prompt 3
Help me use the admin drag-and-drop widget from django-sortedm2m to reorder a playlist.
Prompt 4
Walk me through entering photo IDs directly to set gallery order without the drag-and-drop widget.

Frequently asked questions

wtf is django-sortedm2m?

A Django field that works like a normal many-to-many relationship but remembers the order items were added, ideal for galleries, playlists, or ranked lists.

What language is django-sortedm2m written in?

Mainly Python. The stack also includes Python, Django.

Is django-sortedm2m actively maintained?

Dormant — no commits in 2+ years (last push 2012-10-25).

What license does django-sortedm2m use?

The README does not specify license terms.

How hard is django-sortedm2m to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is django-sortedm2m for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.