Is this really only available to a view? All I want is to know is the auth
user id currently logged in so I can save it into another model, has to be
in the model so it is part of the admin save method
You can't access something in a method unless it gets passed there, of course. "request" isn't some static object, it's instantiated at the beginning of every actual request, naturally. So you can't just import it - what would you import?
Now, your last sentence reveals what you actually want to do, and of course Django has a way to achieve that: override the `save_model` method in the ModelAdmin class. That method does get the request passed in.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment