schema.py 754 B

123456789101112131415161718192021222324252627282930313233343536
  1. from ninja import ModelSchema
  2. from glitchtip.schema import CamelSchema
  3. from .models import User
  4. class UserIn(CamelSchema, ModelSchema):
  5. class Meta:
  6. model = User
  7. fields = [
  8. # "username",
  9. # "emails",
  10. # "identities",
  11. "name",
  12. # "email",
  13. "options",
  14. ]
  15. class UserSchema(CamelSchema, ModelSchema):
  16. class Meta(UserIn.Meta):
  17. fields = [
  18. # "username",
  19. "last_login",
  20. "is_superuser",
  21. # "emails",
  22. # "identities",
  23. "id",
  24. "is_active",
  25. "name",
  26. # "dateJoined",
  27. # "hasPasswordAuth",
  28. "email",
  29. "options",
  30. ]