This Field can not be changed Django Validation Error

Viewed 28

All I am trying to create valiadtion check that will check after saving the "Name" and "Address that field can not be changed, How I can do that?

class Institution(CustomModel):
    name = models.CharField(max_length=256,
                        null=False,
                        blank=False,
                        verbose_name=_('Name'))
    address = models.ForeignKey('Address',
                            on_delete=models.PROTECT,
                            null=False,
                            blank=False,
                            verbose_name=_('Address'))
1 Answers

only you need is setting editable=False in your model Check the Docs

Related