obj.user_id = request.user.id # this is too really?
On 7 янв, 12:55, Collin Grady <[EMAIL PROTECTED]> wrote: > On Jan 6, 1:36 pm, Darthmahon <[EMAIL PROTECTED]> wrote: > > > When I used request.user, it outputs the username of the currently > > logged in user. When I try and use this as part of the entry into the > > table, it won't let me as it's expecting an integer. > > You are mistaken. When /printing/ the user object, it displays > differently, but it is the real User object. > > obj.user = request.user # this is perfectly valid > > obj.user_id = request.user.id # this is too > > obj.user = request.user.id # this is not, because an fkey DOES NOT > want the ID, but the actual object --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---