Found a solution. It works when add fields parameter to serialize, but only when without parent field:
e.g. serializers.serialize("json", c, fields='name,rank') works perfect, while serializers.serialize("json", c, fields='name,rank,parent') raises DoesNotExist exception where c = Category.objects.filter(parent__exact=0) On Apr 2, 1:07 pm, Legioneer <[EMAIL PROTECTED]> wrote: > yes. in admin there are no problems with it. > > On Apr 2, 4:40 am, 1234 <[EMAIL PROTECTED]> wrote: > > > Is this model work on in admin? > > > 2008/4/1, Legioneer <[EMAIL PROTECTED]>: > > > > My data model is very similar to your: > > > > class Category(models.Model): > > > name = models.CharField(max_length=64) > > > descr = models.CharField(max_length=255, blank=True) > > > rank = models.PositiveIntegerField(default=10) > > > parent = models.ForeignKey('self', null=True, blank=True, > > > related_name='child_set') > > > > but because of some reason it doesn't want to to go through JSON > > > serializer :( > > > > Anthony > > > > > this is my example > > > > > class Type(models.Model): > > > > type = models.CharField('分类名称',maxlength=50,core=True) > > > > path = models.CharField > > > ('url地址',maxlength=250,blank=True,editable=False) > > > > typename = models.CharField('分类名称',maxlength=200,editable=False) > > > > parent = models.ForeignKey('self',related_name="munchie",null=True, > > > > blank=True) > > > > created = models.DateTimeField(auto_now_add=True) > > > > > order_id=models.IntegerField ('排序',default=0) > > > > fid=models.IntegerField ('根ID',default=0,editable=False) > > > > cengshu=models.IntegerField ('层数',default=1,editable=False) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---