admin.py 622 B

1234567891011121314151617181920212223
  1. from django.contrib import admin
  2. from import_export import resources
  3. from import_export.admin import ImportExportModelAdmin
  4. from .models import Team
  5. class TeamResource(resources.ModelResource):
  6. class Meta:
  7. model = Team
  8. skip_unchanged = True
  9. fields = ("id", "slug", "created", "organization", "projects", "members")
  10. class TeamAdmin(ImportExportModelAdmin):
  11. search_fields = ("slug",)
  12. list_display = ("slug", "organization")
  13. raw_id_fields = ("organization",)
  14. filter_horizontal = ("members", "projects")
  15. resource_class = TeamResource
  16. admin.site.register(Team, TeamAdmin)