Coverage for src/ptf/admin.py: 0%

30 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-05 09:56 +0000

1from django.contrib import admin 

2from django.contrib.auth.admin import GroupAdmin 

3from django.contrib.auth.admin import UserAdmin 

4from django.contrib.auth.models import Group 

5from django.contrib.auth.models import User 

6 

7from ptf.models import Collection 

8from ptf.models import ExtLink 

9from ptf.models import Provider 

10from ptf.models import Publisher 

11from ptf.models import Resource 

12 

13 

14class PtfAdminSite(admin.AdminSite): 

15 site_header = "Administration" 

16 site_title = "Site admin" 

17 

18 

19class ExtLinkInline(admin.StackedInline): 

20 model = ExtLink 

21 

22 

23class SerialAdmin(admin.ModelAdmin): 

24 inlines = [ExtLinkInline] 

25 ordering = ["title_sort"] 

26 

27 

28class PublisherAdmin(admin.ModelAdmin): 

29 inlines = [ExtLinkInline] 

30 exclude = [ 

31 "publishes", 

32 "provider", 

33 "published", 

34 "pid", 

35 "sid", 

36 "doi", 

37 "lang", 

38 "title_xml", 

39 ] 

40 ordering = ["pub_key"] 

41 

42 

43ptf_admin = PtfAdminSite(name="admin") 

44ptf_admin.register(User, UserAdmin) 

45ptf_admin.register(Group, GroupAdmin) 

46ptf_admin.register(Resource) 

47ptf_admin.register(Collection, SerialAdmin) 

48ptf_admin.register(Publisher, PublisherAdmin) 

49ptf_admin.register(ExtLink) 

50ptf_admin.register(Provider)