Karen Tracey wrote:
> On Sat, May 24, 2008 at 11:11 PM, M.Ganesh <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
>     Hi All,
>
>     Having some problem with foreign key and admin interface :
>
>     
> #models---------------------------------------------------------------------------------------
>     class tagword(models.Model):
>        name = models.CharField(max_length=50)
>
>        def __unicode__(self):
>            return self.name <http://self.name>
>
>        class Admin:
>            pass
>
>        class Meta:
>            ordering = ["name"]
>            app_label = 'common_utils'
>
>     class tag(models.Model):
>        tagword = models.ForeignKey(tagword)
>
>        content_type = models.ForeignKey(ContentType)
>        object_id = models.PositiveIntegerField()
>
>        content_object = generic.GenericForeignKey()
>
>        def __unicode__(self):
>            return self.tagword
>
>        class Admin:
>            pass
>
>        class Meta:
>            ordering = ["tagword"]
>            app_label = 'common_utils'
>     
> #------------------------------------------------------------------------------------------------
>
>     I get the following error while I try to access
>     /admin/common_utils/tag/
>
>     TypeError at /admin/common_utils/tag/
>     coercing to Unicode: need string or buffer, tagword found
>
>     What is my mistake?
>
>
> Your __unicode__ function for tag is returning a tagword object.  Try 
> returning self.tagword.__unicode__() instead.
>
> Karen
>

Thanks Karen, it worked

Regards Ganesh



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to