Commits

Matthew Schinckel committed 25d3704 Merge

Merged in fcurella/django-timedelta-field/packaging (pull request #10)

pip install fails when Django is installed but DJANGO_SETTINGS_MODULE is not set

Comments (0)

Files changed (5)

timedelta/__init__.py

 __version__ = open(os.path.join(os.path.dirname(__file__), "VERSION")).read().strip()
 
 try:
-    from fields import TimedeltaField
-    from helpers import (
+    from django.core.exceptions import ImproperlyConfigured
+except ImportError:
+    ImproperlyConfigured = ImportError
+
+try:
+    from .fields import TimedeltaField
+    from .helpers import (
         divide, multiply, modulo, 
         parse, nice_repr, 
         percentage, decimal_percentage,
         total_seconds
     )
-except ImportError:
-    pass
+except (ImportError, ImproperlyConfigured):
+    pass

timedelta/fields.py

 from collections import defaultdict
 import datetime
 
-from helpers import parse
-from forms import TimedeltaFormField
+from .helpers import parse
+from .forms import TimedeltaFormField
 
 # TODO: Figure out why django admin thinks fields of this type have changed every time an object is saved.
 

timedelta/forms.py

 import datetime
 from collections import defaultdict
 
-from widgets import TimedeltaWidget
-from helpers import parse
+from .widgets import TimedeltaWidget
+from .helpers import parse
 
 class TimedeltaFormField(forms.Field):
     default_error_messages = {

timedelta/tests.py

 
 import datetime
 
-from forms import TimedeltaFormField
-from fields import TimedeltaField
-from widgets import TimedeltaWidget
-from helpers import *
+from .forms import TimedeltaFormField
+from .fields import TimedeltaField
+from .widgets import TimedeltaWidget
+from .helpers import *
 
 class TimedeltaWidgetTest(TestCase):
     def test_render(self):

timedelta/widgets.py

 from django import forms
 import datetime
 
-from helpers import nice_repr, parse
+from .helpers import nice_repr, parse
 
 class TimedeltaWidget(forms.TextInput):
     def __init__(self, *args, **kwargs):