Skip to content

Array shows position ID instead of string value #8155

Discussion options

You must be logged in to vote

The SlugRelatedField and StringRelatedField examples in the docs are both close to what you're looking for.

  • SlugRelatedField can support a read-write field although you'd need name to be a unique model field if that's what you need, eg... name = models.CharField(max_length=255, unique=True)
  • StringRelatedField is read-only, and would need you to define a __str__ method on the Topic model.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kruppy
Comment options

Answer selected by kruppy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants