Skip to content

Commit a3e3704

Browse files
committed
Removing forms.TimeZoneField
It's identical to the modelform default. You can get the same formfield from timezone_field.fields.TimeZoneField.formfield
1 parent 1701460 commit a3e3704

File tree

2 files changed

+2
-39
lines changed

2 files changed

+2
-39
lines changed

timezone_field/forms.py

-13
This file was deleted.

timezone_field/tests.py

+2-26
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
from django.db import models
77
from django.test import TestCase
88

9-
from timezone_field.forms import TimeZoneField as TimeZoneFormField
10-
from timezone_field.fields import TimeZoneField as TimeZoneModelField
9+
from timezone_field.fields import TimeZoneField
1110

1211

1312
class TestModel(models.Model):
14-
timezone = TimeZoneModelField()
13+
timezone = TimeZoneField()
1514

1615

1716
class TimeZoneTestCase(TestCase):
@@ -35,29 +34,6 @@ def assertFormIsValid(self, form):
3534

3635
class TimeZoneFieldTestCase(TimeZoneTestCase):
3736

38-
def test_forms_clean_required(self):
39-
f = TimeZoneFormField()
40-
self.assertEqual(
41-
repr(f.clean("US/Eastern")),
42-
"<DstTzInfo 'US/Eastern' EST-1 day, 19:00:00 STD>"
43-
)
44-
self.assertRaises(forms.ValidationError, f.clean, "")
45-
46-
def test_forms_clean_not_required(self):
47-
f = TimeZoneFormField(required=False)
48-
self.assertEqual(
49-
repr(f.clean("US/Eastern")),
50-
"<DstTzInfo 'US/Eastern' EST-1 day, 19:00:00 STD>"
51-
)
52-
self.assertEqual(f.clean(""), "")
53-
54-
def test_forms_clean_bad_value(self):
55-
f = TimeZoneFormField()
56-
try:
57-
f.clean("BAD VALUE")
58-
except forms.ValidationError, e:
59-
self.assertEqual(e.messages, ["Select a valid choice. BAD VALUE is not one of the available choices."])
60-
6137
def test_models_as_a_form(self):
6238
class TestModelForm(forms.ModelForm):
6339
class Meta:

0 commit comments

Comments
 (0)