admin.py 3.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
from django.contrib import admin
from reversion_compare.admin import CompareVersionAdmin

from backend.models.location import Country, City

from backend.models.location import CountryCulture
from backend.models.location import CountryHealthInsurance
from backend.models.location import CountryOtherInsurance
from backend.models.location import CountryTransport
from backend.models.location import CountryTourism
from backend.models.location import CountryOtherStuff
from backend.models.location import CountryVisaAdministrative
from backend.models.location import CountryPhoto
from backend.models.location import CountryScholarship
from backend.models.location import CountryDri

from backend.models.location import CityTransport
from backend.models.location import CityTourism
from backend.models.location import CityOtherStuff

21 22 23
from backend.models.university import University
from backend.models.university import Campus
from backend.models.university import UniversityScholarship
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

from backend.models.university import UniversityInfo
from backend.models.university import UniversitySemestersDates
from backend.models.university import UniversityInsurance
from backend.models.university import UniversityCourses
from backend.models.university import UniversityCulture
from backend.models.university import UniversityOtherStuff
from backend.models.university import UniversitySpecialOffer
from backend.models.university import UniversityPhoto
from backend.models.university import UniversityDri

from backend.models.university import CampusTransport
from backend.models.university import CampusAccommodation
from backend.models.university import CampusCultureAndStudentLife
from backend.models.university import CampusOtherStuff

from backend.models.module import Currency
from backend.models.otherCore import Department
from backend.models.otherCore import Offer
from backend.models.otherCore import Semester
from backend.models.otherCore import Specialty

from backend.models.user import Recommendation
from backend.models.user import RecommendationList
from backend.models.user import PreviousDeparture
from backend.models.user import PreviousDepartureFeedback
from backend.models.user import UserData

Florent Chehab's avatar
Florent Chehab committed
52
from backend.models.my_model import PendingModeration
53

54 55 56 57
CLASSIC_MODELS = [
    Country,
    City,
    Currency,
58
    University,
59 60 61 62 63 64 65 66
    Department,
    Offer,
    Semester,
    Specialty,
    Recommendation,
    RecommendationList,
    PreviousDeparture,
    PreviousDepartureFeedback,
67 68
    UserData,
    PendingModeration
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
]

VERSIONNED_MODELS = [
    Campus,
    UniversityScholarship,
    UniversityInfo,
    UniversitySemestersDates,
    UniversityInsurance,
    UniversityCulture,
    UniversityCourses,
    UniversityOtherStuff,
    UniversitySpecialOffer,
    UniversityPhoto,
    CountryCulture,
    CountryHealthInsurance,
    CountryOtherInsurance,
    CountryTransport,
    CountryTourism,
    CountryOtherStuff,
    CountryVisaAdministrative,
    CountryPhoto,
    CountryScholarship,
    CityTransport,
    CityTourism,
    CityOtherStuff,
    CampusTransport,
    CampusAccommodation,
    CampusCultureAndStudentLife,
    CampusOtherStuff,
    CountryDri,
    UniversityDri,
]

for model in CLASSIC_MODELS:
    admin.site.register(model)

for model in VERSIONNED_MODELS:
    admin.site.register(model, CompareVersionAdmin)
107 108 109
    if (model.get_serializer().Meta.model != model):
        raise Exception(
            "Get_serializer configuration incorrect in", str(model))