Skip to content

unique_together doesn't work seamlessly #7

@meshy

Description

@meshy

If your sort_order field is unique_together with something, you need to add:

def validate_unique(self, exclude=None):
    f = 'sort_order'
    exclude = [f] if not exclude and f not in exclude else exclude + [f]
    return super(MyModel, self).validate_unique(exclude)

To your model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions