Is it possible to make a Django model read only? No creating, updating etc.
N.B. this question is different to:
Make a Django model read-only? (this question all
You can set managed = False
in your model's Meta
:
from django.db import models
class MyReadOnlyModel(models.Model):
class Meta:
managed = False
If
False
, no database table creation or deletion operations will be performed for this model. This is useful if the model represents an existing table or a database view that has been created by some other means.
https://docs.djangoproject.com/en/dev/ref/models/options/#managed