-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unique over the three values #49
Comments
I pushed something in the branch class MySortedM2M(SortedManyToManyField):
def get_intermediate_model_attributes(self, attrs):
attrs['Meta'].unique_together = (
(attrs['_sort_field_name'], attrs['_to_field_name'], attrs['_from_field_name'],),
)
return attrs Then use your custom field their and it should work well then. |
Currently |
Oops, I didn't push. Sorry! Should be there now. |
Yes, this works. Thanks! |
I did a new refactor of the model creation. So the example from above won't work any more as it had with the branch. However you can now hook into the I'm curious what you think of the refactor in a66b9ac |
I like the way to intercept the creation of the through model with hooks as of overiding some small methods. |
In my current project I have the problem that I want the unique index over the three columns
(from_, to, field.sort_value_field_name)
in generated through model which is currently specified fix: 53322c4a[…]/sortedm2m/fields.py#L74What should I do in this case?
Should be there an option
three_column_unique
?The text was updated successfully, but these errors were encountered: