Opened 12 years ago

Closed 12 years ago

#18711 closed Uncategorized (worksforme)

NamedUrlWizardView looses with "url_name" keyword

Reported by: oic2day@… Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

following directions at
https://docs.djangoproject.com/en/1.4/ref/contrib/formtools/form-wizard/#usage-of-namedurlwizardview

I have a wizard that works (when I don't try to branch, but that's another story). Decided to try as NamedUrlWizard. Fails when my fooWizard.as_view(forms, url_name='bar') is called
If I comment out both keywords (url_name, done_step_name) it doesn't fail although I'm not sure if it "works" (I don't know what the expected behavior should be when the extra UrlWizardView mechanism is used).

The code (formtools/wizard/views.py) uses a construct in the body that I'm not familiar with. But its signature would seem to allow any keywords.

Here's the stack trace

Environment:

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

Django Version: 1.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',

'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'registration',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.flatpages',
'hike_calc')

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',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')

Traceback:
File "/home/pothiers/.virtualenvs/hc/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response

  1. request.path_info)

File "/home/pothiers/.virtualenvs/hc/lib/python2.7/site-packages/django/core/urlresolvers.py" in resolve

  1. for pattern in self.url_patterns:

File "/home/pothiers/.virtualenvs/hc/lib/python2.7/site-packages/django/core/urlresolvers.py" in url_patterns

  1. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)

File "/home/pothiers/.virtualenvs/hc/lib/python2.7/site-packages/django/core/urlresolvers.py" in urlconf_module

  1. self._urlconf_module = import_module(self.urlconf_name)

File "/home/pothiers/.virtualenvs/hc/lib/python2.7/site-packages/django/utils/importlib.py" in import_module

  1. import(name)

File "/home/pothiers/sandbox/hike_calculator_site/hike_calculator/urls.py" in <module>

  1. done_step_name='finished'

File "/home/pothiers/.virtualenvs/hc/lib/python2.7/site-packages/django/contrib/formtools/wizard/views.py" in as_view

  1. return super(WizardView, cls).as_view(initkwargs)

File "/home/pothiers/.virtualenvs/hc/lib/python2.7/site-packages/django/views/generic/base.py" in as_view

  1. cls.name, key))

Exception Type: TypeError at /hike_calc/hikeReq/
Exception Value: HikeRequestWizard() received an invalid keyword 'url_name'

Change History (1)

comment:1 by Tim Graham, 12 years ago

Resolution: worksforme
Status: newclosed

Are you sure your fooWizard class inherits from NamedUrlWizard?

Note: See TracTickets for help on using tickets.
Back to Top