hagsteel / swampdragon

swampdragon
Other
557 stars 73 forks source link

Related Serializer #127

Closed chogarcia closed 9 years ago

chogarcia commented 9 years ago

How a simple code like this isn't working? What am I doing wrong here?

class ArticleSerializer(ModelSerializer):
    class Meta:
        model = 'ihr.Article'
        publish_fields = ('quote',)

class LiveUpdateSerializer(ModelSerializer):
    articles = ArticleSerializer

    class Meta:
        model = 'ihr.LiveUpdate'
        publish_fields = ('title', 'articles')

Doing with Django shell

serializer = LiveUpdateSerializer(instance=obj)
serializer.serialize()

throws: AttributeError: type object 'LiveUpdate' has no attribute 'articles'

BuckinghamIO commented 9 years ago

Your going to need to paste your models.

tomchristie commented 9 years ago

I'd suggest closing this issue as non-actionable.

hagsteel commented 9 years ago

Closing as nothing is happening here as well