I am trying just to do an API REST with the project of:
specifically with the model of Question
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.ForeignKey(Question)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
I want to apply a serializer with question's choices but I don't know how to do it
class QuestionSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Question
fields = ('id', 'question_text', ????? )
I need some suggestion to solve this problem.
thanks in advance