summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-07-03 14:16:21 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-07-03 14:16:21 +0000
commit63a7b95693d53e42607f30c7b5966913ebb83aa5 (patch)
tree56f086d5d706075ae6c1f4b40909a4536b3784f9 /docs
parent7b5869e140379bb4a6525bc5e48a1dc069635d23 (diff)
[1.0.X] Fixed #9669 -- Corrected an answer in the admin FAQ that is wrong in a post-newforms-admin world. Thanks to Alex for the report.
Merge of r11175 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@11177 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/faq/admin.txt19
-rw-r--r--docs/ref/contrib/admin.txt2
2 files changed, 11 insertions, 10 deletions
diff --git a/docs/faq/admin.txt b/docs/faq/admin.txt
index c23bdd1fe9..4c7b570f00 100644
--- a/docs/faq/admin.txt
+++ b/docs/faq/admin.txt
@@ -37,20 +37,19 @@ Set the :setting:`CACHE_MIDDLEWARE_ANONYMOUS_ONLY` setting to ``True``. See the
How do I automatically set a field's value to the user who last edited the object in the admin?
-----------------------------------------------------------------------------------------------
-At this point, Django doesn't have an official way to do this. But it's an oft-requested
-feature, so we're discussing how it can be implemented. The problem is we don't want to couple
-the model layer with the admin layer with the request layer (to get the current user). It's a
-tricky problem.
-
-One person hacked up a `solution that doesn't require patching Django`_, but note that it's an
-unofficial solution, and there's no guarantee it won't break at some point.
-
-.. _solution that doesn't require patching Django: http://lukeplant.me.uk/blog.php?id=1107301634
+The :class:`ModelAdmin` class provides customization hooks that allow you to transform
+an object as it saved, using details from the request. By extracting the current user
+from the request, and customizing the :meth:`ModelAdmin.save_model` hook, you can update
+an object to reflect the user that edited it. See :ref:`the documentation on ModelAdmin
+methods <model-admin-methods>` for an example.
How do I limit admin access so that objects can only be edited by the users who created them?
---------------------------------------------------------------------------------------------
-See the answer to the previous question.
+The :class:`ModelAdmin` class also provides customization hooks that allow you to control the
+visibility and editability of objects in the admin. Using the same trick of extracting the
+user from the request, the :meth:`ModelAdmin.queryset` and :meth:`ModelAdmin.has_change_permission`
+can be used to control the visibility and editability of objects in the admin.
My admin-site CSS and images showed up fine using the development server, but they're not displaying when using mod_python.
---------------------------------------------------------------------------------------------------------------------------
diff --git a/docs/ref/contrib/admin.txt b/docs/ref/contrib/admin.txt
index bd6ca468ee..d856dfdc4f 100644
--- a/docs/ref/contrib/admin.txt
+++ b/docs/ref/contrib/admin.txt
@@ -620,6 +620,8 @@ objects. Templates can override or extend base admin templates as described in
If you don't specify this attribute, a default template shipped with Django
that provides the standard appearance is used.
+.. _model-admin-methods:
+
``ModelAdmin`` methods
----------------------