jpwatts / django-positions

A Django field for custom model ordering.
BSD 3-Clause "New" or "Revised" License
284 stars 71 forks source link

Multiple 'unique_for_fields' ? #2

Closed litchfield closed 14 years ago

litchfield commented 15 years ago

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

Any thoughts on accommodating this?

smulloni commented 14 years ago

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.

jpwatts commented 14 years ago

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

litchfield commented 14 years ago

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