|
|
|
|
@ -1,6 +1,9 @@ |
|
|
|
|
from django.conf import settings |
|
|
|
|
from django.apps import apps |
|
|
|
|
from .models import BaseModel |
|
|
|
|
from django.contrib.auth import get_user_model |
|
|
|
|
|
|
|
|
|
User = get_user_model() |
|
|
|
|
|
|
|
|
|
class SyncRegistry: |
|
|
|
|
def __init__(self): |
|
|
|
|
@ -12,7 +15,7 @@ class SyncRegistry: |
|
|
|
|
app_models = apps.get_app_config(app_label).get_models() |
|
|
|
|
for model in app_models: |
|
|
|
|
if hasattr(model, '_meta') and not model._meta.abstract: |
|
|
|
|
if issubclass(model, BaseModel): |
|
|
|
|
if issubclass(model, BaseModel) or model == User: |
|
|
|
|
model_name = model.__name__ |
|
|
|
|
if self.should_sync_model(model_name, config): |
|
|
|
|
self.register(model) |
|
|
|
|
|