class MyModel(models.Model):
name = models.CharField()
thing1 = models.ForeignKey(MyModel2)
thing2 = models.ForeignKey(MyModel3)
class MyModel2(modles.Model):
name = models.CharField()
address = models.CharField()
phone = models.CharField()
class MyModel3(models.Model):
name = models.CharField()
value = models.DecimalField()
related = ForeignKey(MyModel2)
class MyModelSerializer(serializers.ModelSerializer):
thing2 = serializers.SlugRelatedField(slug_field='name', required=False, queryset=???)
def get_queryset(self):
return self.object.thing1.mymodel3_set.all()
On Jun 26, 2015, at 10:21 AM, Tom Christie <christ...@gmail.com> wrote:
Maybe use a standard SlugRelatedField, but include some multi-field validation in the serializer.validate() method?(The available options wouldn't be filtered in the browsable API, but it'd let you do the validation you're after, right?)
--
You received this message because you are subscribed to a topic in the Google Groups "Django REST framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-rest-framework/xm8KkL3Vjnc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.