1
0
mirror of https://github.com/django/django.git synced 2025-07-05 02:09:13 +00:00

Merged to r802

git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Robert Wittams 2005-10-08 14:37:05 +00:00
parent 5923c63c8d
commit 0442a5440a
4 changed files with 24 additions and 5 deletions

View File

@ -53,11 +53,15 @@ def main():
parser = DjangoOptionParser(get_usage()) parser = DjangoOptionParser(get_usage())
parser.add_option('--settings', parser.add_option('--settings',
help='Python path to settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.') help='Python path to settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.')
parser.add_option('--pythonpath',
help='Lets you manually add a directory the Python path, e.g. "/home/djangoprojects/myproject".')
options, args = parser.parse_args() options, args = parser.parse_args()
# Take care of options. # Take care of options.
if options.settings: if options.settings:
os.environ['DJANGO_SETTINGS_MODULE'] = options.settings os.environ['DJANGO_SETTINGS_MODULE'] = options.settings
if options.pythonpath:
sys.path.insert(0, options.pythonpath)
# Run the appropriate action. Unfortunately, optparse can't handle # Run the appropriate action. Unfortunately, optparse can't handle
# positional arguments, so this has to parse/validate them. # positional arguments, so this has to parse/validate them.

View File

@ -1475,9 +1475,7 @@ def function_get_sql_clause(opts, **kwargs):
table_prefix = opts.db_table + '.' table_prefix = opts.db_table + '.'
else: else:
table_prefix = '' table_prefix = ''
order_by.append('%s%s %s' % (table_prefix, orderfield2column(col_name, opts), order)) order_by.append('%s%s %s' % (table_prefix, orderfield2column(col_name, opts), order))
order_by = ", ".join(order_by) order_by = ", ".join(order_by)
# LIMIT and OFFSET clauses # LIMIT and OFFSET clauses

View File

@ -636,6 +636,10 @@ class ForeignKey(Field):
Field.__init__(self, **kwargs) Field.__init__(self, **kwargs)
def get_manipulator_field_objs(self): def get_manipulator_field_objs(self):
rel_field = self.rel.get_related_field()
if self.rel.raw_id_admin and not isinstance(rel_field, AutoField):
return rel_field.get_manipulator_field_objs()
else:
return [formfields.IntegerField] return [formfields.IntegerField]
def get_db_prep_save(self,value): def get_db_prep_save(self,value):

View File

@ -183,7 +183,7 @@ Available options
================= =================
--settings --settings
========== ----------
Example usage:: Example usage::
@ -193,8 +193,21 @@ Explicitly specifies the settings module to use. The settings module should be
in Python path syntax, e.g. "myproject.settings.main". If this isn't provided, in Python path syntax, e.g. "myproject.settings.main". If this isn't provided,
``django-admin.py`` will use the DJANGO_SETTINGS_MODULE environment variable. ``django-admin.py`` will use the DJANGO_SETTINGS_MODULE environment variable.
--pythonpath
------------
Example usage::
django-admin.py init --pythonpath='/home/djangoprojects/myproject'
Adds the given filesystem path to the Python `import search path`_. If this
isn't provided, ``django-admin.py`` will use the ``PYTHONPATH`` environment
variable.
.. _import search path: http://diveintopython.org/getting_to_know_python/everything_is_an_object.html
--help --help
====== ------
Displays a help message that includes a terse list of all available actions and Displays a help message that includes a terse list of all available actions and
options. options.