              TestSerializer():
                  id = IntegerField(label='ID', read_only=True)
                  foreign_key = PrimaryKeyRelatedField(queryset=ForeignKeyTargetModel.objects.all())
                  one_to_one = PrimaryKeyRelatedField(queryset=OneToOneTargetModel.objects.all(), validators=[<UniqueValidator(queryset=RelationalModel.objects.all())>])
                  many_to_many = PrimaryKeyRelatedField(many=True, queryset=ManyToManyTargetModel.objects.all())
                  through = PrimaryKeyRelatedField(many=True, read_only=True)
          """)
          self.assertEqual(unicode_repr(TestSerializer()), expected)
  
      def test_nested_relations(self):
 
</s> remove                 many_to_many = HyperlinkedRelatedField(many=True, queryset=ManyToManyTargetModel.objects.all(), view_name='manytomanytargetmodel-detail')
 </s> add                 many_to_many = HyperlinkedRelatedField(allow_empty=False, many=True, queryset=ManyToManyTargetModel.objects.all(), view_name='manytomanytargetmodel-detail')
                many_to_many = PrimaryKeyRelatedField(allow_empty=False, many=True, queryset=ManyToManyTargetModel.objects.all())
              TestSerializer():
                  id = IntegerField(label='ID', read_only=True)
                  foreign_key = PrimaryKeyRelatedField(queryset=ForeignKeyTargetModel.objects.all())
                  one_to_one = PrimaryKeyRelatedField(queryset=OneToOneTargetModel.objects.all(), validators=[<UniqueValidator(queryset=RelationalModel.objects.all())>])
                many_to_many = PrimaryKeyRelatedField(allow_empty=False, many=True, queryset=ManyToManyTargetModel.objects.all())
                  through = PrimaryKeyRelatedField(many=True, read_only=True)
          """)
          self.assertEqual(unicode_repr(TestSerializer()), expected)
  
      def test_nested_relations(self):
keep keep keep keep replace keep keep keep keep keep
 Respect blank on many to many, and set allow_empty=False if it is not present. Closes #2804. 
tests/test_model_serializer.py