How do I disable the green icon on specific 'manytomany' or 'foreignkey' fields in automatically generated forms.
Using css as follows:
.add-another {
display: none;
}
disables all of them which I don't want.
An example would be the weekdays model (storing days from monday to sunday). A foreign key pointing to this model shows the green plus icon which would allow users to edit/corrupt the data in model.
Is there a way to disable this in the default generated forms (To save time in writing custom forms just to achieve this)?
Also, one can argue that most of the content in this model is static, so rather than creating a foreign key to point to this model, scrap 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)
The problem now would be, what if the superuser/superadmin who will be a non-programmer want to remove saturday and sunday through the admin without going into the code?
Found the answer :)
Each person logging into the admin system has a set of permissions and groups managed through the django user manager area.
A person would not see the 'green plus icon' beside a drop down (foreign key / manytomany field) if he/she doesn't have permission (under django) to edit it.