English 中文(简体)
取消对所有Django行政模式的许可
原标题:Remove delete permission for all Django admin models

我有大约50个行政模型,模型Admin作为基类。 现在我想删除所有50个模式的特点。 我认为有两种方式。

  1. Redefine has_delete_permission method to return false and remove delete_selected action for all the 50 models (lot of work).
  2. Do the same thing as mentioned above in django.contrib.admin.AdminModel. which means altering the source code.

我不想改变源码。 是否有其他办法可以采取上述两种方式?

问题回答

页: 1 设立一个行政混合班,进行这两项调整,并增加现有50个模型的基类

页: 1 M. MonkeyTOP ModelAdmin(将影响所有模式,而不仅仅是你的50)

页: 1 您的行政管理(如果是all<>m> > /em> ,你只能通过注册的行政管理,与属于贵方的行政管理相匹配。

我会亲自到会。 是否还有其他一些情况是,这些示范性污染物是否有共同之处? 添加基类/恶毒是一种一次性的努力,因此,你可以非常容易地把其他变化缩小到底线上。

P.S.:如果你想确保这些模型被删除,那么,或许应当确保它们的违约经理能够删除:





相关问题
Column/field level permissions in Django admin site?

Is it possible to implement column level permissions per user in the Django admin site? Its a small project and I only need two groups of permissions. In the docs I cant find anything out of the box ...

Django: Serving admin media files

I am trying to serve static files from another domain (sub domain of current domain). To serve all media files I used this settings: MEDIA_URL = http://media.bud-inform.co.ua/ So when in ...

Django ValueError at /admin/

I am running Django with mod_python on a Red Hat Linux box in production. A little while ago, for a reason unknown to me, the admin stopped working, throwing a 500 error. The error is as follows: ...

Django ordered ManyToManyField in admin interface

I have a legacy database with tables for documents and authors. A third table defines an ordered many to many relationship between the documents and authors, using foreign keys to the documents and ...

Django Admin - Re-authentication?

I m in a bit of a dilemma at the moment regarding Django s admin backend. The default authentication system allows already logged-in users that have staff privileges to access the admin site, however ...

Django auto_now and auto_now_add

For Django 1.1. I have this in my models.py: class User(models.Model): created = models.DateTimeField(auto_now_add=True) modified = models.DateTimeField(auto_now=True) When updating a row I ...

Negative custom Django admin FilterSpec

I m working on a custom Django Admin FilterSpec (covered already on SO #991926). My FilterSpec is a replacement for the default filter on ForeignKey(User), and basically replaces the list of all ...