klipstein/dojango — Issue #92: Error when trying to use dojango.forms
Author: thedrow
Created: 2011-11-07 18:48:45+00:00
State: open

I get the following traceback when trying to include dojango.forms

```Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/

Django Version: 1.3.1
Python Version: 2.7.1
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'omerkatz.website',
'dojango',
'disqus',
'blog']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'dojango.middleware.DojoCollector')

Traceback:
File "C:\Python27\environments\website\lib\site-packages\django\core\handlers\base.py" in get_response
101. request.path_info)
File "C:\Python27\environments\website\lib\site-packages\django\core\urlresolvers.py" in resolve
250. for pattern in self.url_patterns:
File "C:\Python27\environments\website\lib\site-packages\django\core\urlresolvers.py" in _get_url_patterns
279. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Python27\environments\website\lib\site-packages\django\core\urlresolvers.py" in _get_urlconf_module
274. self._urlconf_module = import_module(self.urlconf_name)
File "C:\Python27\environments\website\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name)
File "C:\Users\Omer\PycharmProjects\omerkatz\urls.py" in
6. admin.autodiscover()
File "C:\Python27\environments\website\lib\site-packages\django\contrib\admin\__init__.py" in autodiscover
26. import_module('%s.admin' % app)
File "C:\Python27\environments\website\lib\site-packages\django\utils\importlib.py" in import_module
35. __import__(name)
File "C:\Users\Omer\PycharmProjects\omerkatz\blog\admin.py" in
6. from blog.forms import DraftPostModelForm, ScheduledPostModelForm, PublishedPostModelForm
File "C:\Users\Omer\PycharmProjects\omerkatz\blog\forms.py" in
2. from dojango.forms.models import ModelForm
File "C:\Python27\environments\website\lib\site-packages\dojango\forms\__init__.py" in
3. from fields import *

Exception Type: AttributeError at /
Exception Value: 'module' object has no attribute 'DEFAULT_DATE_INPUT_FORMATS'
```

Here's the offending code:

```python
from datetime import datetime
from dojango.forms.models import ModelForm
from dojango.forms.widgets import EditorInput, DateInput
from dojango.forms.fields import CharField, DateField
from blog.models import ScheduledPost, DraftPost, PublishedPost

class PublishedPostModelForm(ModelForm):
content = CharField(required=False,
help_text='Please enter content',
widget=EditorInput())

class Meta:
model = PublishedPost

class DraftPostModelForm(ModelForm):
content = CharField(required=False,
help_text='Please enter content',
widget=EditorInput())

class Meta:
model = DraftPost

class ScheduledPostModelForm(ModelForm):
published_on = DateField(
min_value=datetime.now(),
required=True,
help_text="Enter a valid date!",
widget=DateInput(
attrs={
'invalidMessage': 'The date is invalid!'
})
)

class Meta:
model = ScheduledPost
```

What could be wrong?