On Sunday 22 March 2009 09:25:42 am Brian Neal wrote: > On Mar 22, 8:15 am, Joshua Partogi <joshua.j...@gmail.com> wrote: > > Dear all, > > > > I just encounter this error using pyscopg2 as my db adapter > > Exception Type: ProgrammingError > > Exception Value: can't adapt > > Exception Location: > > /usr/lib/python2.5/site-packages/django/db/backends/util.py in > > execute, line 19 > > > > The query that I'm trying to run from admin is as such: > > def save_model(self, request, obj, form, change): > > user = User.objects.get(username=request.user) > > > > Does anybody know how I can run this with psycopg? What's wrong with > > these statements? What did I miss here? > > It would help if you posted your model. > > But from what you posted, I'm guessing that line needs to read: > > obj.user = User.objects.get(username=request.user) >
I think what you want to do with this style is: obj.user = User.objects.get(username=request.user.username) > or maybe just > > obj.user = request.user > yeah, I think this is best. Tho if you're the type that sanitizes everything, the upper one is better. > --BN > --~--~---------~--~----~------------~-------~--~----~ > 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 > django-users+unsubscr...@googlegroups.com For more options, visit this > group at http://groups.google.com/group/django-users?hl=en > -~----------~----~----~----~------~----~------~--~--- Mike -- Didn't I buy a 1951 Packard from you last March in Cairo?
signature.asc
Description: This is a digitally signed message part.