Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d2b1747716
Fetching contributors…

Cannot retrieve contributors at this time

file 48 lines (36 sloc) 1.813 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 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
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.models import User, Group
from django.contrib.auth.admin import UserAdmin
from django.contrib.sites.models import Site

from django_descriptors.models import Descriptor
from django_descriptors.admin import DescriptorAdmin

from artworks.models import Artwork, Virgin, Serie # ArtworkCreator
from artworks.admin import (ArtworkAdmin, SerieAdmin,
                            VirginAdmin) # ArtworkCreatorAdmin
from base.models import BibliographicReference, GeospatialReference, Image
from base.admin import (BibliographicReferenceAdmin, GeospatialReferenceAdmin,
                        ImageAdmin)
from creators.models import Creator, School, WorkingHistory
from creators.admin import CreatorAdmin, SchoolAdmin, WorkingHistoryAdmin


class AdminSite(admin.AdminSite):

    def has_permission(self, request):
        return request.user.is_superuser or request.user.is_staff


def setup_admin():
    admin_site.register(User, UserAdmin)
    admin_site.register(Group, admin.ModelAdmin)
    admin_site.register(Site, admin.ModelAdmin)

    admin_site.register(Descriptor, DescriptorAdmin)

    admin_site.register(BibliographicReference, BibliographicReferenceAdmin)
    admin_site.register(GeospatialReference, GeospatialReferenceAdmin)
    admin_site.register(Image, ImageAdmin)

    admin_site.register(Serie, SerieAdmin)
    admin_site.register(Virgin, VirginAdmin)
    admin_site.register(Artwork, ArtworkAdmin)
    # admin_site.register(ArtworkCreator, ArtworkCreatorAdmin)

    admin_site.register(Creator, CreatorAdmin)
    admin_site.register(School, SchoolAdmin)
    admin_site.register(WorkingHistory, WorkingHistoryAdmin)

admin_site = AdminSite(name=settings.PROJECT_NAME)
setup_admin()
Something went wrong with that request. Please try again.