2👍
✅
somehow like this
def test(*args,**kwargs):
view_name = kwargs.pop('view')
view = getattr(social.views,view_name)
return view(*args, **kwargs)
urlpatterns = patterns('',
url(r'^test/(?P<view>.*)$', test),
...
)
or like this
VIEWS_LIST = ['signup','submit_signup','signup_complete']
urlpatterns = patterns('social.views',
*[url('%s/' % view,view) for view in VIEWS_LIST]
)
0👍
If you want to make signup process of multiple steps than you can user Django form wizard. In this way you don’t need to change url for every signup step. The URL will look like this:
url(r'^signup/$', SignupWizard([SignupForm_1, SignupForm_2, SignupFormComplete]) ),
Check the form wizard documentation.
- [Answered ]-Add conditional filter to ListView Django
- [Answered ]-Where to add a method for a model?
- [Answered ]-Setting the initial value for a readonly Choice (ForeignKey) field
- [Answered ]-Django use string as a query object attribute
- [Answered ]-Dajaxice not found on production server
Source:stackexchange.com