Monday, May 31, 2010

Auto populate currently logged in user's user id in forms

Hi.
Here what I have done http://github.com/gvkalra/showtime/blob/master/photo/views.py

What I want to do is:
Auto populate the database with currently logged in user's user id
like it has been done with the date of creation of the record by
using
uploaded = models.DateField(auto_now_add=True)

how to do that with:
clicked_by = models.ForeignKey(User) ??

something like
clicked_by = models.ForeignKey(User.username, editable=False)

{though it doesn't work, but just to demonstrate the idea} ........

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment