admin.py 753 Bytes
Newer Older
1
2
from django.contrib import admin

3
from reversion_compare.admin import CompareVersionAdmin
4
from backend_app.config.models import get_models
5

6
7
8
# We need to register testing models, otherwise we won't be able to test properly,
# Since no migrations would privide those models.
# So don't put requires_testing=True
9
10
VERSIONED_MODELS = get_models(versioned=True)  # , requires_testing=False)
CLASSIC_MODELS = get_models(versioned=False)  # , requires_testing=False)
11
12
13

#######
# Register the models
Florent Chehab's avatar
Florent Chehab committed
14
#######
15

Florent Chehab's avatar
Florent Chehab committed
16
17
18
for Model in CLASSIC_MODELS:
    # Register the model in the admin in a standard way
    admin.site.register(Model)
19

20
for Model in VERSIONED_MODELS:
Florent Chehab's avatar
Florent Chehab committed
21
22
    # Register the model in the admin with versioning
    admin.site.register(Model, CompareVersionAdmin)