0

In Django 2.0, the Admin introduces an auto complete field. It works great but I can't seem to figure out a way to prevent the user from changing the foreign key object that is mapped in, without making it read only. If I make it read only the foreign key object is not editable using the edit button.

Any suggestions?

eskhool
  • 657
  • 1
  • 11
  • 24
  • It is not really clear to me what you want to be able to edit, and what not. The foreign key and/or the object values to which it refers? – Willem Van Onsem Oct 02 '18 at 12:14
  • In the clean method of the modelform, you may raise a vailidation error if the relevant field is changed. https://stackoverflow.com/a/46680590/2996101 – raratiru Oct 02 '18 at 12:30

0 Answers0