Disable only certain green plus icons in auto-generated forms

How to disable the green icon in the special fields "manytomany" or "foreignkey" in automatically generated forms.

Using css as follows:

.add-another { display: none; } 

disconnects everything that I do not need.

An example is the weekday model (storing days from Monday to Sunday). A foreign key pointing to this model shows a green plus icon that will allow users to edit / corrupt data in the model.

Is there a way to disable this in default forms (to save time when writing custom forms for this)?

In addition, it can be argued that most of the content in this model is static, so instead of creating a foreign key to point to this model, cancel this model and do something like this:

 WEEK_DAYS = [ (MONDAY, 'monday')), (TUESDAY, 'tuesday')), #. . . so on ] class AModel(models.Model): weekday_dropdown = models.CharField(max_length=10, choices=WEEK_DAYS, default=ENABLED) 

Now the problem is that if a superuser / superadmin who is not a programmer wants to delete Saturday and Sunday through the administrator without entering the code?

+2
django django-admin django-forms
source share
1 answer

Found the answer :)

Each user logged in to the administrator has a set of permissions and groups managed through the django user manager area.

A person will not see the green plus icon next to the drop-down (foreign key / multi-voice field) if he / she does not have permission (under django) to edit it.

+2
source share

All Articles