Which version of Django are you using?

As a first attempt, I'd replace your __str__ method by __unicode__ and
replace the calls to 'str' by 'unicode'.

On Jul 18, 7:02 am, andrewljohnson <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am getting a strange programming error, and I wonder what causes it?
>
> The Error
> ========
> ProgrammingError at /trips/viewtrip/2/
> ERROR: current transaction is aborted, commands ignored until end of
> transaction block SET client_encoding to 'UNICODE'
>
> This error is triggered by calling {{trip.owner}}
>
> If you go to this URL you will see the error in question (I have debug
> mode turned on):http://www.trailbehind.com/trips/viewtrip/2/
>
> A Couple of Notes
> ==============
> 1) This error does not occur if you are logged in as the trip.owner
> (i.e. trip.owner == request.user).
>
> 2. This error doesn't occur on my development machine, and I think
> that may be because I am running a slightly different version of
> psycopg.
>
> 3. Here are my relevant models:
>
> class Trip(models.Model):
>     """A trip, future or present"""
>     owner = models.ForeignKey("UserProfile", related_name="owner")
>     start_date = models.DateField(null = True)
>     end_date = models.DateField(null = True)
>     time_created  = models.DateField(auto_now=True)
>
>     park = models.ForeignKey(Park, blank = True, null = True)
>     route = models.ManyToManyField(Trail, null = True, blank = True)
>
>     comments = generic.GenericRelation(Comment, null = True, blank =
> True)
>
>     invitee_list = models.ManyToManyField("Invitee")
>
>     def __str__(self):
>         return  str(self.id)
>
>     class Admin:
>         pass
>
> class UserProfile(models.Model):
>     """Extra data about each user."""
>
>     user = models.ForeignKey(User, unique=True, null=True, blank=True)
>     summary = models.TextField(null=True)
>     url = models.URLField(null=True)
>     home_address = models.TextField(null=True)
>     phone_number = models.PhoneNumberField(null=True)
>     email_address = models.EmailField(null=True, unique=True)
>     user_key = models.CharField(max_length=64, null=True)
>
>     comments = generic.GenericRelation(Comment)
>
>     def __str__(self):
>         if self.user:
>             return str(self.user)
>         return str(False)
>
>     class Admin:
>         pass
>
> Thanks for any help!
>
> Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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