mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[1.0.X] A whole lotta documentation fixes, backported from r10303 on trunk.
I got my commit message cut off the first try, but luckily I get to still thank Kevin Kubasik for rolling all these fixes up into a single easy patch. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10306 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -678,8 +678,17 @@ It is important you use a ``ModelForm`` here otherwise things can break. See the
|
||||
============================
|
||||
|
||||
The admin interface has the ability to edit models on the same page as a
|
||||
parent model. These are called inlines. You can add them to a model by
|
||||
specifying them in a ``ModelAdmin.inlines`` attribute::
|
||||
parent model. These are called inlines. Suppose you have these two models::
|
||||
|
||||
class Author(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
class Book(models.Model):
|
||||
author = models.ForeignKey(Author)
|
||||
title = models.CharField(max_length=100)
|
||||
|
||||
You can edit the books authored by an author on the author page. You add
|
||||
inlines to a model by specifying them in a ``ModelAdmin.inlines``::
|
||||
|
||||
class BookInline(admin.TabularInline):
|
||||
model = Book
|
||||
@@ -1012,7 +1021,7 @@ Hooking ``AdminSite`` instances into your URLconf
|
||||
|
||||
The last step in setting up the Django admin is to hook your ``AdminSite``
|
||||
instance into your URLconf. Do this by pointing a given URL at the
|
||||
``AdminSite.root`` method.
|
||||
``AdminSite.urls`` method.
|
||||
|
||||
In this example, we register the default ``AdminSite`` instance
|
||||
``django.contrib.admin.site`` at the URL ``/admin/`` ::
|
||||
|
||||
@@ -155,9 +155,10 @@ A complete form might look like::
|
||||
{% get_comment_form for event as form %}
|
||||
<form action="{% comment_form_target %}" method="POST">
|
||||
{{ form }}
|
||||
<p class="submit">
|
||||
<input type="submit" name="preview" class="submit-post" value="Preview">
|
||||
</p>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" name="preview" class="submit-post" value="Preview"></td>
|
||||
</tr>
|
||||
</form>
|
||||
|
||||
Be sure to read the `notes on the comment form`_, below, for some special
|
||||
|
||||
@@ -324,6 +324,14 @@ same types of lookups manually::
|
||||
... object_id=b.id)
|
||||
[<TaggedItem: django>, <TaggedItem: python>]
|
||||
|
||||
Note that if the model with a :class:`~django.contrib.contenttypes.generic.GenericForeignKey`
|
||||
that you're referring to uses a non-default value for ``ct_field`` or ``fk_field``
|
||||
(e.g. the :mod:`django.contrib.comments` app uses ``ct_field="object_pk"``),
|
||||
you'll need to pass ``content_type_field`` and ``object_id_field`` to
|
||||
:class:`~django.contrib.contenttypes.generic.GenericRelation`.::
|
||||
|
||||
comments = generic.GenericRelation(Comment, content_type_field="content_type", object_id_field="object_pk")
|
||||
|
||||
Note that if you delete an object that has a
|
||||
:class:`~django.contrib.contenttypes.generic.GenericRelation`, any objects
|
||||
which have a :class:`~django.contrib.contenttypes.generic.GenericForeignKey`
|
||||
|
||||
@@ -290,7 +290,7 @@ Advanced FormWizard methods
|
||||
.. method:: FormWizard.render_template
|
||||
|
||||
Renders the template for the given step, returning an
|
||||
:class:`~django.http.HttpResponseRedirect` object.
|
||||
:class:`~django.http.HttpResponse` object.
|
||||
|
||||
Override this method if you want to add a custom context, return a different
|
||||
MIME type, etc. If you only need to override the template name, use
|
||||
|
||||
Reference in New Issue
Block a user