Hi,
I'm trying to translate form names from a model. I have a working contact
form for example and have the following code....
============================
from django import forms
from django.core.mail import mail_managers
from django.utils.translation import ugettext_lazy as _
class ContactForm(forms.Form):
name = forms.CharField(_('name'), max_length=100)
==========================
It adds it to my .po file ok, but when I run it in the browser I get the
following error...
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8080/contact/
Django Version: 1.3.1
Python Version: 2.7.3
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.formtools',
'django.contrib.admindocs',
'tagging',
'blog']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django_mobile.middleware.MobileDetectionMiddleware',
'django_mobile.middleware.SetFlavourMiddleware')
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
in get_response
101. request.path_info)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py"
in resolve
250. for pattern in self.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py"
in _get_url_patterns
279. patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py"
in _get_urlconf_module
274. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in
import_module
35. __import__(name)
File "/home/phil/project/urls.py" in <module>
2. from views import *
File "/home/phil/project/views.py" in <module>
7. from forms import ContactForm
File "/home/phil/project/forms.py" in <module>
5. class ContactForm(forms.Form):
File "/home/phil/project/forms.py" in ContactForm
6. name = forms.CharField(_('name'), max_length=100)
Exception Type: TypeError at /contact/
Exception Value: __init__() got multiple values for keyword argument
'max_length'
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/m5L_nLBNK6cJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.