Advertisement
Korotkodul

django перОл admin 2

Jan 20th, 2022 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. from django.contrib import admin
  2. from .models import University
  3. from .models import olympiads, organizer, profile, year, ol_organizer, ol_number_int_list, ol_info
  4.  
  5. admin.site.register(University)
  6. admin.site.register(olympiads)
  7. admin.site.register(organizer)
  8. admin.site.register(profile)
  9. admin.site.register(year)
  10. admin.site.register(ol_organizer)
  11. admin.site.register(ol_number_int_list)
  12. admin.site.register(ol_info)
  13.  
  14. class UniversityAdmin(admin.ModelAdmin):
  15. list_display = ("id", "short_name", "country", "url")
  16. list_display_links = ("short_name",)
  17. list_filter = ("country",)
  18. search_fields = ("short_name", "country",)
  19.  
  20.  
  21. class olympiadsAdmin(admin.ModelAdmin):
  22. list_display = ("name","url")
  23. list_display_links = ("name")
  24. list_filter = ("name")
  25. search_fields = ("name")
  26.  
  27.  
  28. class organizerAdmin(admin.ModelAdmin):
  29. list_display = ("id", "name")
  30. list_display_links = ("name")
  31. list_filter = ("name")
  32. search_fields = ("name")
  33.  
  34.  
  35.  
  36. class profileAdmin(admin.ModelAdmin):
  37. list_display = ("id", "name")
  38. list_display_links = ("name")
  39. list_filter = ("name")
  40. search_fields = ("name")
  41.  
  42.  
  43. class yearAdmin(admin.ModelAdmin):
  44. list_display = ("id", "num_of_year")
  45. list_display_links = ("name")
  46. list_filter = ("name")
  47. search_fields = ("name")
  48.  
  49.  
  50. class ol_organizerAdmin(admin.ModelAdmin):
  51. list_display = ("id_year", "id_ol", "id_org")
  52. list_display_links = ("id_ol", "id_year")
  53. list_filter = ("id_ol", "id_year")
  54. search_fields = ("id_ol", "id_year")
  55.  
  56.  
  57. class ol_number_int_listAdmin(admin.ModelAdmin):
  58. list_display = ("id_year", "id_ol", "number_in_list")
  59. list_display_links = ("id_ol", "id_year")
  60. list_filter = ("id_ol", "id_year")
  61. search_fields = ("id_ol", "id_year")
  62.  
  63.  
  64. class ol_infoAdmin(admin.ModelAdmin):
  65. list_display = ("id_ol","id_year","id_subj","id_prof", "level" )
  66. list_display_links = ("id_ol", "id_year")
  67. list_filter = ("id_ol", "id_year")
  68. search_fields = ("id_ol", "id_year")
  69.  
  70.  
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement