resources.py 620 B

123456789101112131415161718192021222324
  1. from import_export import resources
  2. from .models import Organization, OrganizationUser
  3. class OrganizationResource(resources.ModelResource):
  4. class Meta:
  5. model = Organization
  6. skip_unchanged = True
  7. fields = ("id", "slug", "name", "created", "organization")
  8. class OrganizationUserResource(resources.ModelResource):
  9. class Meta:
  10. model = OrganizationUser
  11. skip_unchanged = True
  12. fields = (
  13. "id",
  14. "user",
  15. "organization",
  16. "role",
  17. "email",
  18. )
  19. import_id_fields = ("user", "email", "organization")