开发者

Restrict a user from creating more than 'n' customers in Django admin

开发者 https://www.devze.com 2023-02-17 01:11 出处:网络
In Django admin, how can I restrict a user from creating more than \'n\' customers开发者_C百科?if customer is added to the main model as an InlineModel, then you just need to specufy max_num property

In Django admin, how can I restrict a user from creating more than 'n' customers开发者_C百科?


if customer is added to the main model as an InlineModel, then you just need to specufy max_num property (docs).

If this is a main model (not inline), the simplest is IMHO to override ModelAdmin's save method and check if adding additional customer is allowed.

0

精彩评论

暂无评论...
验证码 换一张
取 消