It appears that you're using the Django Rest Framework, and if that's the
case then you need to reference the section on serializer relations:
http://www.django-rest-framework.org/api-guide/relations


On Thu, Feb 20, 2014 at 3:53 PM, Antonio Villavicencio <[email protected]>wrote:

> I am trying just to do an API REST with the project of:
> https://docs.djangoproject.com/en/dev/intro/tutorial01/
>
> 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
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a2b02a3d-f5bf-4a78-b848-48b0e076d5f3%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Jonathan D. Baker
Developer
http://jonathandbaker.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPMFOb5f1VDmSk75sRAe6Egs%2BHb3h2zVyJ3KE6AOLJzBKei31Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to