http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser -richard
On 5/19/08, enri57ar <[EMAIL PROTECTED]> wrote: > > > How access to request object within models ? > > > from django.contrib.auth.models import User > > Class Message(models.Model): > message = ... > user_id = models.ForeignKey(User) > > def save(self): > user_id = request.user.id # doesn't work > super(Mensaje, self).save() > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---