It has been asked before but I haven't seen any definitive answer. Is there 
a way to enforce unique constraint or index on multiple fields or if not 
are there any plans to implement it? It can come handy in checking data 
integrity and lots of databases support it. 

Without this feature a user can easily insert the same row more than once 
and checking needs to be done in controller whereas this type of error 
could have been easily checked by database. 

For example, using appadmin I can easily insert duplicate values in 
auth_membership where it doesn't make sense to have these rows duplicated. 

auth_membership.id<http://127.0.0.1:8000/kuvar/appadmin/select/db?orderby=auth_membership.id>
auth_membership.user_id<http://127.0.0.1:8000/kuvar/appadmin/select/db?orderby=auth_membership.user_id>
auth_membership.group_id<http://127.0.0.1:8000/kuvar/appadmin/select/db?orderby=auth_membership.group_id>
1 <http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_membership/1>Dragan 
Matic (1) <http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_user/1>user_1 
(1) 
<http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_group/1>2<http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_membership/2>Dragan
 
Matic (1) <http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_user/1>user_1 
(1) 
<http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_group/1>3<http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_membership/3>Dragan
 
Matic (1) <http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_user/1>user_1 
(1) <http://127.0.0.1:8000/kuvar/appadmin/update/db/auth_group/1>


Regards
Dragan 
















-- 



Reply via email to