updated docs
[django-tables2.git] / django_tables / __init__.py
1 # -*- coding: utf8 -*-
2 # (major, minor, bugfix, "pre-alpha" | "alpha" | "beta" | "final", release | 0)
3 VERSION = (0, 2, 0, 'alpha', 0)
4
5
6 def get_version():
7     version = '%s.%s' % (VERSION[0], VERSION[1])
8     if VERSION[2]:
9         version = '%s.%s' % (version, VERSION[2])
10     if VERSION[3:] == ('alpha', 0):
11         version = '%s pre-alpha' % version
12     else:
13         if VERSION[3] != 'final':
14             version = '%s %s %s' % (version, VERSION[3], VERSION[4])
15     return version
16
17
18 # We want to make get_version() available to setup.py even if Django is not
19 # available or we are not inside a Django project.
20 try:
21     import django
22 except ImportError:
23     import warnings
24     warnings.warn('django-tables requires Django, however it is not installed.'
25         ' Version information will still be available.')
26 else:
27     try:
28         # http://docs.djangoproject.com/en/dev/topics/settings/ says::
29         #
30         #   If you don't set DJANGO_SETTINGS_MODULE and don't call configure(),
31         #   Django will raise an ImportError exception the first time a setting is
32         #   accessed.
33         #
34         from django.conf import settings
35         settings.DEBUG  # will raise ImportError if Django isn't configured
36     except ImportError:
37         # allow get_version() to remain available
38         import warnings
39         warnings.warn('django-tables requires Django to be configured... but '
40             "it isn't! A bunch of stuff won't work :(")
41
42     from tables import *
43     from columns import *