0👍
You can do this if you use database routers with
def allow_migrate(self, db, app_label, model_name=None, **hints):
return False
Example.
class FilemakerRouter:
"""
A router to control all database operations on models in the
filemaker application.
"""
def db_for_read(self, model, **hints):
"""
Attempts to read filemaker models go to filemaker.
"""
if model._meta.app_label == 'filemaker':
return 'filemaker'
return None
def db_for_write(self, model, **hints):
"""
Attempts to write filemaker models go to filemaker.
"""
if model._meta.app_label == 'filemaker':
return 'filemaker'
return None
def allow_relation(self, obj1, obj2, **hints):
"""
Allow relations if a model in the filemaker app is involved.
"""
if obj1._meta.app_label == 'filemaker' or \
obj2._meta.app_label == 'filemaker':
return True
return None
def allow_migrate(self, db, app_label, model_name=None, **hints):
return False
- Django – Custom permissions for function based views
- How change Schemes from HTTP to HTTPS in drf_yasg?
Source:stackexchange.com