0

I have a model with three fields. I have defined it as Modelform. I have written views to add, read and delete objects of this model. Now when I edit, I want to enable one field. The user can edit this field only. How to do this?

models.py

class MyModel(models.Model):
    Field1 = models.ForeignKey(DiffModel1, null=False)
    Field2 = models.ForeignKey(DiffModel2, null=False)
    Field3 = models.IntegerField(default=0, null=False)
Rajkumar R
  • 743
  • 1
  • 10
  • 27

1 Answers1

0

After going through the previous questions in SO and documentation, I have decided to create a new ModelForm which excludes other fields in the Meta class. I used this new ModelForm only while editing. This solved my problem.

Rajkumar R
  • 743
  • 1
  • 10
  • 27