Try this http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser

On Jun 17, 6:02 am, saxon75 <[EMAIL PROTECTED]> wrote:
> I'm working on a CMS application and had a question about
> automatically setting certain model fields.
>
> Suppose I have the following model (this is simplified from the actual
> application):
>
> class Item(models.Model):
>     author = models.ForeignKey(User)
>     created = models.DateTimeField()
>     title = models.CharField(max_length=255)
>     body = models.TextField()
>
> Now, when I go to create a new Item, whether via the admin site or a
> custom newforms-based form, it requires that I select an author from a
> list of existing users.  What I'd prefer is to leave out the author
> field entirely from the add form and have that field automatically set
> to the current user.  How can I do that?
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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