I am serializing an external key set using the Django Rest Framework, I have the following models:
class Transaction(models.Model): ... class TransactionStatus(models.Model): transaction = models.ForeignKey(Transaction) ...
I have a serializer for both of these models, one of which looks like this:
class TransactionSerializer(serializers.ModelSerializer): transactionstatus_set = TransactionStatusSerializer(many=True, read_only=True) class Meta: model = Transaction depth = 1 fields = ('id', 'transactionstatus_set')
I want to have here a list of transaction statuses from backsetsetsetsetsetsetsetsetsetsetset ... But transaction_set just seems like a very inconvenient name in the API for this.
source share