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?
django django-admin django-forms
sysasa
source share