jpwatts / django-positions

A Django field for custom model ordering.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple 'unique_for_fields' ?

litchfield opened this issue · comments

Sometimes there are more than on FK in a model that positioning needs to be unique for.

Any thoughts on accommodating this?

I could use this also, so I've added this in a fork (http://github.com/smulloni/django-positions). It isn't backwards-compatible, in that it replaces the unique_for_field parameter with a new, plural one (unique_for_fields). Adding backwards compatibility would be trivial, however, if that was deemed essential. Beyond that, the old tests pass, and there is a start of a test with a multi-column FK, but there needs to a bit more there.

I haven't gotten a chance to look closely at the fork yet, but unique_for_fields seems like a logical change to make.

Looking good. Backwards compatibility I'd say yes definitely but deprecate it going forward.