mirror of
https://github.com/django/django.git
synced 2025-07-03 17:29:12 +00:00
boulder-oracle-sprint: Merged to [5508]
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@5509 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
750549569e
commit
829b25833a
2
AUTHORS
2
AUTHORS
@ -100,11 +100,13 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
Marc Fargas <telenieko@telenieko.com>
|
Marc Fargas <telenieko@telenieko.com>
|
||||||
favo@exoweb.net
|
favo@exoweb.net
|
||||||
Bill Fenner <fenner@gmail.com>
|
Bill Fenner <fenner@gmail.com>
|
||||||
|
Stefane Fermgier <sf@fermigier.com>
|
||||||
Matthew Flanagan <http://wadofstuff.blogspot.com>
|
Matthew Flanagan <http://wadofstuff.blogspot.com>
|
||||||
Eric Floehr <eric@intellovations.com>
|
Eric Floehr <eric@intellovations.com>
|
||||||
Jorge Gajon <gajon@gajon.org>
|
Jorge Gajon <gajon@gajon.org>
|
||||||
gandalf@owca.info
|
gandalf@owca.info
|
||||||
Baishampayan Ghose
|
Baishampayan Ghose
|
||||||
|
glin@seznam.cz
|
||||||
martin.glueck@gmail.com
|
martin.glueck@gmail.com
|
||||||
GomoX <gomo@datafull.com>
|
GomoX <gomo@datafull.com>
|
||||||
Simon Greenhill <dev@simon.net.nz>
|
Simon Greenhill <dev@simon.net.nz>
|
||||||
|
@ -30,7 +30,12 @@ function dismissRelatedLookupPopup(win, chosenId) {
|
|||||||
function showAddAnotherPopup(triggeringLink) {
|
function showAddAnotherPopup(triggeringLink) {
|
||||||
var name = triggeringLink.id.replace(/^add_/, '');
|
var name = triggeringLink.id.replace(/^add_/, '');
|
||||||
name = name.replace(/\./g, '___');
|
name = name.replace(/\./g, '___');
|
||||||
var win = window.open(triggeringLink.href + '?_popup=1', name, 'height=500,width=800,resizable=yes,scrollbars=yes');
|
href = triggeringLink.href
|
||||||
|
if (href.indexOf('?') == -1)
|
||||||
|
href += '?_popup=1';
|
||||||
|
else
|
||||||
|
href += '&_popup=1';
|
||||||
|
var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
|
||||||
win.focus();
|
win.focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -79,32 +79,32 @@ class PasswordResetForm(oldforms.Manipulator):
|
|||||||
|
|
||||||
def isValidUserEmail(self, new_data, all_data):
|
def isValidUserEmail(self, new_data, all_data):
|
||||||
"Validates that a user exists with the given e-mail address"
|
"Validates that a user exists with the given e-mail address"
|
||||||
try:
|
self.users_cache = list(User.objects.filter(email__iexact=new_data))
|
||||||
self.user_cache = User.objects.get(email__iexact=new_data)
|
if len(self.users_cache) == 0:
|
||||||
except User.DoesNotExist:
|
|
||||||
raise validators.ValidationError, _("That e-mail address doesn't have an associated user account. Are you sure you've registered?")
|
raise validators.ValidationError, _("That e-mail address doesn't have an associated user account. Are you sure you've registered?")
|
||||||
|
|
||||||
def save(self, domain_override=None, email_template_name='registration/password_reset_email.html'):
|
def save(self, domain_override=None, email_template_name='registration/password_reset_email.html'):
|
||||||
"Calculates a new password randomly and sends it to the user"
|
"Calculates a new password randomly and sends it to the user"
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
new_pass = User.objects.make_random_password()
|
for user in self.users_cache:
|
||||||
self.user_cache.set_password(new_pass)
|
new_pass = User.objects.make_random_password()
|
||||||
self.user_cache.save()
|
user.set_password(new_pass)
|
||||||
if not domain_override:
|
user.save()
|
||||||
current_site = Site.objects.get_current()
|
if not domain_override:
|
||||||
site_name = current_site.name
|
current_site = Site.objects.get_current()
|
||||||
domain = current_site.domain
|
site_name = current_site.name
|
||||||
else:
|
domain = current_site.domain
|
||||||
site_name = domain = domain_override
|
else:
|
||||||
t = loader.get_template(email_template_name)
|
site_name = domain = domain_override
|
||||||
c = {
|
t = loader.get_template(email_template_name)
|
||||||
'new_password': new_pass,
|
c = {
|
||||||
'email': self.user_cache.email,
|
'new_password': new_pass,
|
||||||
'domain': domain,
|
'email': user.email,
|
||||||
'site_name': site_name,
|
'domain': domain,
|
||||||
'user': self.user_cache,
|
'site_name': site_name,
|
||||||
}
|
'user': user,
|
||||||
send_mail('Password reset on %s' % site_name, t.render(Context(c)), None, [self.user_cache.email])
|
}
|
||||||
|
send_mail('Password reset on %s' % site_name, t.render(Context(c)), None, [user.email])
|
||||||
|
|
||||||
class PasswordChangeForm(oldforms.Manipulator):
|
class PasswordChangeForm(oldforms.Manipulator):
|
||||||
"A form that lets a user change his password."
|
"A form that lets a user change his password."
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
<li class="{% cycle odd,even %}"><a href="{{ object.url }}">{{ object }}</a></li>
|
<li class="{% cycle odd,even %}"><a href="{{ object.url }}">{{ object }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="quiet">(None)</p>
|
<p class="quiet">(None)</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -19,7 +19,7 @@ class RedirectFallbackMiddleware(object):
|
|||||||
except Redirect.DoesNotExist:
|
except Redirect.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
if r is not None:
|
if r is not None:
|
||||||
if r == '':
|
if r.new_path == '':
|
||||||
return http.HttpResponseGone()
|
return http.HttpResponseGone()
|
||||||
return http.HttpResponsePermanentRedirect(r.new_path)
|
return http.HttpResponsePermanentRedirect(r.new_path)
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ been reviewed for security issues. Don't use it for production use.
|
|||||||
|
|
||||||
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
|
||||||
from types import ListType, StringType
|
from types import ListType, StringType
|
||||||
import os, re, sys, time, urllib
|
import os, re, sys, time, urllib, mimetypes
|
||||||
|
|
||||||
__version__ = "0.1"
|
__version__ = "0.1"
|
||||||
__all__ = ['WSGIServer','WSGIRequestHandler','demo_app']
|
__all__ = ['WSGIServer','WSGIRequestHandler','demo_app']
|
||||||
@ -629,6 +629,9 @@ class AdminMediaHandler(object):
|
|||||||
else:
|
else:
|
||||||
status = '200 OK'
|
status = '200 OK'
|
||||||
headers = {}
|
headers = {}
|
||||||
|
mime_type = mimetypes.guess_type(file_path)[0]
|
||||||
|
if mime_type:
|
||||||
|
headers['Content-Type'] = mime_type
|
||||||
output = [fp.read()]
|
output = [fp.read()]
|
||||||
fp.close()
|
fp.close()
|
||||||
start_response(status, headers.items())
|
start_response(status, headers.items())
|
||||||
|
@ -17,8 +17,10 @@ probably already have it installed.
|
|||||||
Install Apache and mod_python
|
Install Apache and mod_python
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
If you just want to experiment with Django, skip this step. Django comes with
|
If you just want to experiment with Django, skip ahead to the next
|
||||||
its own Web server for development purposes.
|
section; Django includes a lightweight web server you can use for
|
||||||
|
testing, so you won't need to set up Apache until you're ready to
|
||||||
|
deploy Django in production.
|
||||||
|
|
||||||
If you want to use Django on a production site, use Apache with `mod_python`_.
|
If you want to use Django on a production site, use Apache with `mod_python`_.
|
||||||
mod_python is similar to mod_perl -- it embeds Python within Apache and loads
|
mod_python is similar to mod_perl -- it embeds Python within Apache and loads
|
||||||
@ -86,23 +88,20 @@ If you installed Django using ``setup.py install``, uninstalling
|
|||||||
is as simple as deleting the ``django`` directory from your Python
|
is as simple as deleting the ``django`` directory from your Python
|
||||||
``site-packages``.
|
``site-packages``.
|
||||||
|
|
||||||
If you installed Django from a Python Egg, remove the Django ``.egg`` file,
|
If you installed Django from a Python egg, remove the Django ``.egg`` file,
|
||||||
and remove the reference to the egg in the file named ``easy-install.pth``.
|
and remove the reference to the egg in the file named ``easy-install.pth``.
|
||||||
This file should also be located in your ``site-packages`` directory.
|
This file should also be located in your ``site-packages`` directory.
|
||||||
|
|
||||||
.. admonition:: Where are my ``site-packages`` stored?
|
.. admonition:: Where are my ``site-packages`` stored?
|
||||||
|
|
||||||
The location of the ``site-packages`` directory depends on the operating
|
The location of the ``site-packages`` directory depends on the operating
|
||||||
system, and the location in which Python was installed. However, the
|
system, and the location in which Python was installed. To find out your
|
||||||
following locations are common:
|
system's ``site-packages`` location, execute the following::
|
||||||
|
|
||||||
* If you're using Linux: ``/usr/lib/python2.X/site-packages``
|
python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
|
||||||
|
|
||||||
* If you're using Windows: ``C:\Python2.X\lib\site-packages``
|
(Note that this should be run from a shell prompt, not a Python interactive
|
||||||
|
prompt.)
|
||||||
* If you're using MacOSX: ``/Library/Python2.X/site-packages`` or
|
|
||||||
``/Library/Frameworks/Python.framework/Versions/2.X/lib/python2.X/site-packages/``
|
|
||||||
(in later releases).
|
|
||||||
|
|
||||||
Install the Django code
|
Install the Django code
|
||||||
=======================
|
=======================
|
||||||
@ -141,12 +140,15 @@ latest bug fixes and improvements, follow these instructions:
|
|||||||
|
|
||||||
1. Make sure you have Subversion_ installed.
|
1. Make sure you have Subversion_ installed.
|
||||||
2. Check out the Django code into your Python ``site-packages`` directory.
|
2. Check out the Django code into your Python ``site-packages`` directory.
|
||||||
|
|
||||||
On Linux / Mac OSX / Unix, do this::
|
On Linux / Mac OSX / Unix, do this::
|
||||||
|
|
||||||
svn co http://code.djangoproject.com/svn/django/trunk/ django_src
|
svn co http://code.djangoproject.com/svn/django/trunk/ django_src
|
||||||
ln -s `pwd`/django_src/django /usr/lib/python2.3/site-packages/django
|
ln -s `pwd`/django_src/django SITE-PACKAGES-DIR/django
|
||||||
|
|
||||||
(In the above line, change ``python2.3`` to match your current Python version.)
|
(In the above line, change ``SITE-PACKAGES-DIR`` to match the location of
|
||||||
|
your system's ``site-packages`` directory, as explained in the
|
||||||
|
"Where are my ``site-packages`` stored?" section above.)
|
||||||
|
|
||||||
On Windows, do this::
|
On Windows, do this::
|
||||||
|
|
||||||
|
@ -1893,11 +1893,11 @@ used by the SQLite Python bindings. This is for the sake of consistency and
|
|||||||
sanity.)
|
sanity.)
|
||||||
|
|
||||||
A final note: If all you want to do is a custom ``WHERE`` clause, you can just
|
A final note: If all you want to do is a custom ``WHERE`` clause, you can just
|
||||||
just the ``where``, ``tables`` and ``params`` arguments to the standard lookup
|
use the ``where``, ``tables`` and ``params`` arguments to the standard lookup
|
||||||
API. See `Other lookup options`_.
|
API. See `Other lookup options`_.
|
||||||
|
|
||||||
.. _Python DB-API: http://www.python.org/peps/pep-0249.html
|
.. _Python DB-API: http://www.python.org/peps/pep-0249.html
|
||||||
.. _Other lookup options: ../db-api/#extra-params-select-where-tables
|
.. _Other lookup options: ../db-api/#extra-select-none-where-none-params-none-tables-none
|
||||||
.. _transaction handling: ../transactions/
|
.. _transaction handling: ../transactions/
|
||||||
|
|
||||||
Overriding default model methods
|
Overriding default model methods
|
||||||
|
@ -110,7 +110,7 @@ shortly.
|
|||||||
Creating ``Form`` instances
|
Creating ``Form`` instances
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
A ``Form`` instance is either **bound** or **unbound** to a set of data.
|
A ``Form`` instance is either **bound** to a set of data, or **unbound**.
|
||||||
|
|
||||||
* If it's **bound** to a set of data, it's capable of validating that data
|
* If it's **bound** to a set of data, it's capable of validating that data
|
||||||
and rendering the form as HTML with the data displayed in the HTML.
|
and rendering the form as HTML with the data displayed in the HTML.
|
||||||
|
@ -10,7 +10,7 @@ poll application.
|
|||||||
It'll consist of two parts:
|
It'll consist of two parts:
|
||||||
|
|
||||||
* A public site that lets people view polls and vote in them.
|
* A public site that lets people view polls and vote in them.
|
||||||
* An admin site that lets you add, change and delete poll.
|
* An admin site that lets you add, change and delete polls.
|
||||||
|
|
||||||
We'll assume you have `Django installed`_ already. You can tell Django is
|
We'll assume you have `Django installed`_ already. You can tell Django is
|
||||||
installed by running the Python interactive interpreter and typing
|
installed by running the Python interactive interpreter and typing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user