On Thursday, February 10, 2011 2:27:15 PM UTC, Szabo, Patrick (LNG-VIE) wrote: > > I imorted from django.contrib.auth.models import User but when i do > > Mitarbeiter = request.user.id > > It tells me that NameError: name 'request' is not defined > > What am i doing wrong ?! >
The first thing you are doing wrong is having a ten-line signature, top-posting, and not trimming previous messages. The second thing is not thinking things through properly. Objects are only accessible in Python if you make them available. The request is passed into the view. How do you expect to access it in your model? You don't show where that Mitarbeiter assignment is taking place. If you're inside a model method, you'll need to pass the request into that method. Importing the User model is irrelevant here. -- DR. -- 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.