diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-02-17 18:33:09 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-02-17 18:33:09 +0000 |
| commit | a10e8153f324ef58714269e99ec0882b68b832ca (patch) | |
| tree | 7fb8b6aea98304bce578aeb794ce3a92d39a99f8 | |
| parent | c14e6929528512b7201654d630983f2c219ebc46 (diff) | |
Fixed #1177 -- Added django.VERSION and '--version' command to django-admin.py/manage.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2328 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/__init__.py | 1 | ||||
| -rw-r--r-- | django/core/management.py | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/django/__init__.py b/django/__init__.py index e69de29bb2..593e2f46e4 100644 --- a/django/__init__.py +++ b/django/__init__.py @@ -0,0 +1 @@ +VERSION = (0, 9, 1, 'SVN') diff --git a/django/core/management.py b/django/core/management.py index 5ea9539d25..46938b7642 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -63,6 +63,14 @@ def _is_valid_dir_name(s): # field as the field to which it points. get_rel_data_type = lambda f: (f.get_internal_type() in ('AutoField', 'PositiveIntegerField', 'PositiveSmallIntegerField')) and 'IntegerField' or f.get_internal_type() +def get_version(): + "Returns the version as a human-format string." + from django import VERSION + v = '.'.join([str(i) for i in VERSION[:-1]]) + if VERSION[3]: + v += ' (%s)' % VERSION[3] + return v + def get_sql_create(mod): "Returns a list of the CREATE TABLE SQL statements for the given module." from django.core import db, meta @@ -900,7 +908,7 @@ def print_error(msg, cmd): def execute_from_command_line(action_mapping=DEFAULT_ACTION_MAPPING): # Parse the command-line arguments. optparse handles the dirty work. - parser = DjangoOptionParser(get_usage(action_mapping)) + parser = DjangoOptionParser(usage=get_usage(action_mapping), version=get_version()) 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.') parser.add_option('--pythonpath', |
