Snippet List
If you have a model with foreign key to User, you can use this manager to show (i.e. in admin interface) only objects, that are related to currently logged-in user. Superuser sees all objects, not only his.
Requires: [ThreadlocalsMiddleware](http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser)
- filter
- foreignkey
- user
- manager
- queryset
- owner
- users
- user-foreign-key
This is a little helper for associating an owner to a newly created object, in this case making the assumption that the current user is always the owner. It removes the necessity of adding a custom save hook to your model.
get_current_user comes from this middleware trick to cache the current user:
http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser
- model
- user
- field
- owner
- ownerfield
2 snippets posted so far.