Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #9669 -- Corrected an answer in the admin FAQ that is wrong in …

…a post-newforms-admin world. Thanks to Alex for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11175 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 36954a04b7b6142c8338c6abfcffb67e1ee82aad 1 parent 8728507
Russell Keith-Magee authored July 03, 2009
19  docs/faq/admin.txt
@@ -37,20 +37,19 @@ Set the :setting:`CACHE_MIDDLEWARE_ANONYMOUS_ONLY` setting to ``True``. See the
37 37
 How do I automatically set a field's value to the user who last edited the object in the admin?
38 38
 -----------------------------------------------------------------------------------------------
39 39
 
40  
-At this point, Django doesn't have an official way to do this. But it's an oft-requested
41  
-feature, so we're discussing how it can be implemented. The problem is we don't want to couple
42  
-the model layer with the admin layer with the request layer (to get the current user). It's a
43  
-tricky problem.
44  
-
45  
-One person hacked up a `solution that doesn't require patching Django`_, but note that it's an
46  
-unofficial solution, and there's no guarantee it won't break at some point.
47  
-
48  
-.. _solution that doesn't require patching Django: http://lukeplant.me.uk/blog.php?id=1107301634
  40
+The :class:`ModelAdmin` class provides customization hooks that allow you to transform
  41
+an object as it saved, using details from the request. By extracting the current user
  42
+from the request, and customizing the :meth:`ModelAdmin.save_model` hook, you can update
  43
+an object to reflect the user that edited it. See :ref:`the documentation on ModelAdmin
  44
+methods <model-admin-methods>` for an example.
49 45
 
50 46
 How do I limit admin access so that objects can only be edited by the users who created them?
51 47
 ---------------------------------------------------------------------------------------------
52 48
 
53  
-See the answer to the previous question.
  49
+The :class:`ModelAdmin` class also provides customization hooks that allow you to control the
  50
+visibility and editability of objects in the admin. Using the same trick of extracting the
  51
+user from the request, the :meth:`ModelAdmin.queryset` and :meth:`ModelAdmin.has_change_permission`
  52
+can be used to control the visibility and editability of objects in the admin.
54 53
 
55 54
 My admin-site CSS and images showed up fine using the development server, but they're not displaying when using mod_python.
56 55
 ---------------------------------------------------------------------------------------------------------------------------
2  docs/ref/contrib/admin/index.txt
@@ -704,6 +704,8 @@ objects. Templates can override or extend base admin templates as described in
704 704
 If you don't specify this attribute, a default template shipped with Django
705 705
 that provides the standard appearance is used.
706 706
 
  707
+.. _model-admin-methods:
  708
+
707 709
 ``ModelAdmin`` methods
708 710
 ----------------------
709 711
 

0 notes on commit 36954a0

Please sign in to comment.
Something went wrong with that request. Please try again.