mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
[multi-db] Merge trunk to [3657].
git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@3662 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f67b8c6698
commit
ac28f828a8
@ -195,7 +195,7 @@ def filter_interface_script_maybe(bound_field):
|
||||
f = bound_field.field
|
||||
if f.rel and isinstance(f.rel, models.ManyToManyRel) and f.rel.filter_interface:
|
||||
return '<script type="text/javascript">addEvent(window, "load", function(e) {' \
|
||||
' SelectFilter.init("id_%s", "%s", %s, "%s"); });</script>\n' % (
|
||||
' SelectFilter.init("id_%s", %r, %s, "%s"); });</script>\n' % (
|
||||
f.name, f.verbose_name, f.rel.filter_interface-1, settings.ADMIN_MEDIA_PREFIX)
|
||||
else:
|
||||
return ''
|
||||
|
@ -3,6 +3,7 @@ from django.template import loader, RequestContext
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.http import HttpResponse
|
||||
from django.conf import settings
|
||||
from django.core.xheaders import populate_xheaders
|
||||
|
||||
DEFAULT_TEMPLATE = 'flatpages/default.html'
|
||||
|
||||
@ -32,4 +33,6 @@ def flatpage(request, url):
|
||||
c = RequestContext(request, {
|
||||
'flatpage': f,
|
||||
})
|
||||
return HttpResponse(t.render(c))
|
||||
response = HttpResponse(t.render(c))
|
||||
populate_xheaders(request, response, FlatPage, f.id)
|
||||
return response
|
||||
|
27
docs/faq.txt
27
docs/faq.txt
@ -16,12 +16,17 @@ hours to take a complicated Web application from concept to public launch.
|
||||
At the same time, the World Online Web developers have consistently been
|
||||
perfectionists when it comes to following best practices of Web development.
|
||||
|
||||
Thus, Django was designed not only to allow fast Web development, but
|
||||
*best-practice* Web development.
|
||||
In fall 2003, the World Online developers (Adrian Holovaty and Simon Willison)
|
||||
ditched PHP and began using Python to develop its Web sites. As they built
|
||||
intensive, richly interactive sites such as Lawrence.com, they began to extract
|
||||
a generic Web development framework that let them build Web applications more
|
||||
and more quickly. They tweaked this framework constantly, adding improvements
|
||||
over two years.
|
||||
|
||||
Django would not be possible without a whole host of open-source projects --
|
||||
`Apache`_, `Python`_, and `PostgreSQL`_ to name a few -- and we're thrilled to
|
||||
be able to give something back to the open-source community.
|
||||
In summer 2005, World Online decided to open-source the resulting software,
|
||||
Django. Django would not be possible without a whole host of open-source
|
||||
projects -- `Apache`_, `Python`_, and `PostgreSQL`_ to name a few -- and we're
|
||||
thrilled to be able to give something back to the open-source community.
|
||||
|
||||
.. _Apache: http://httpd.apache.org/
|
||||
.. _Python: http://www.python.org/
|
||||
@ -42,8 +47,8 @@ Django is pronounced **JANG**-oh. Rhymes with FANG-oh. The "D" is silent.
|
||||
Is Django stable?
|
||||
-----------------
|
||||
|
||||
Yes. World Online has been using Django for more than two years. Sites built on
|
||||
Django have weathered traffic spikes of over one million hits an hour and a
|
||||
Yes. World Online has been using Django for more than three years. Sites built
|
||||
on Django have weathered traffic spikes of over one million hits an hour and a
|
||||
number of Slashdottings. Yes, it's quite stable.
|
||||
|
||||
Does Django scale?
|
||||
@ -630,6 +635,14 @@ You can also use the Python API. See `creating users`_ for full info.
|
||||
Contributing code
|
||||
=================
|
||||
|
||||
How can I get started contributing code to Django?
|
||||
--------------------------------------------------
|
||||
|
||||
Thanks for asking! We've written an entire document devoted to this question.
|
||||
It's titled `Contributing to Django`_.
|
||||
|
||||
.. _Contributing do Django: http://www.djangoproject.com/documentation/contributing/
|
||||
|
||||
I submitted a bug fix in the ticket system several weeks ago. Why are you ignoring my patch?
|
||||
--------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -1222,10 +1222,13 @@ A few special cases to note about ``list_display``:
|
||||
of the related object.
|
||||
|
||||
* ``ManyToManyField`` fields aren't supported, because that would entail
|
||||
executing a separate SQL statement for each row in the table.
|
||||
executing a separate SQL statement for each row in the table. If you
|
||||
want to do this nonetheless, give your model a custom method, and add
|
||||
that method's name to ``list_display``. (See below for more on custom
|
||||
methods in ``list_display``.)
|
||||
|
||||
* If the field is a ``BooleanField``, Django will display a pretty "on" or
|
||||
"off" icon instead of ``True`` or ``False``.
|
||||
* If the field is a ``BooleanField`` or ``NullBooleanField``, Django will
|
||||
display a pretty "on" or "off" icon instead of ``True`` or ``False``.
|
||||
|
||||
* If the string given is a method of the model, Django will call it and
|
||||
display the output. This method should have a ``short_description``
|
||||
@ -1262,6 +1265,16 @@ A few special cases to note about ``list_display``:
|
||||
return '<span style="color: #%s;">%s %s</span>' % (self.color_code, self.first_name, self.last_name)
|
||||
colored_name.allow_tags = True
|
||||
|
||||
* The ``__str__()`` method is just as valid in ``list_display`` as any
|
||||
other model method, so it's perfectly OK to do this::
|
||||
|
||||
list_display = ('__str__', 'some_other_field')
|
||||
|
||||
* For any element of ``list_display`` that is not a field on the model, the
|
||||
change list page will not allow ordering by that column. This is because
|
||||
ordering is done at the database level, and Django has no way of knowing
|
||||
how to order the result of a custom method at the SQL level.
|
||||
|
||||
``list_display_links``
|
||||
----------------------
|
||||
|
||||
|
@ -159,7 +159,7 @@ of contents for your app, it contains a simple mapping between URL patterns and
|
||||
Python callback functions. URLconfs also serve to decouple URLs from Python
|
||||
code.
|
||||
|
||||
Here's what a URLconf might look like for the above ``Reporter``/``Article``
|
||||
Here's what a URLconf might look like for the ``Reporter``/``Article``
|
||||
example above::
|
||||
|
||||
from django.conf.urls.defaults import *
|
||||
|
Loading…
x
Reference in New Issue
Block a user