JSON serializer is not working for subset of fields.

2016-01-05 Thread sonu kumar
Models class Country(models.Model): country = CountryField() class City(models.Model): name = models.CharField(max_length=1000) country = models.ForeignKey(Country) country = request.POST['country'] country = get_object_or_404(Country, country=country) cities = serializers.seria

Re: JSON serializer is not working for subset of fields.

2016-01-05 Thread sonu kumar
country = request.POST['country'] country = get_object_or_404(Country, country=country) On Tuesday, January 5, 2016 at 6:02:28 PM UTC+5:30, sonu kumar wrote: > > Models > > class Country(models.Model): > country = CountryField() > > class City(models.Model): > name = models.CharField(ma

JSON serializer is not working for subset of fields.

2016-01-05 Thread sonu kumar
Models class Country(models.Model): country = CountryField() class City(models.Model): name = models.CharField(max_length=1000) country = models.ForeignKey(Country) cities = serializers.serialize("json", country.city_set.all(), fields=('name', 'id')) In this it should return JSO