我试图创建2个CreateView(step1,step2),在第一个视图中我创建了一个用户(djangomodels.user)。你知道吗
class UserStep1(CreateView):
model = User
fields = [
'username',
'password',
]
def get_success_url(self):
return reverse('step-2',args=(self.object.id,))
template_name = 'step1.html'
在第一个表单提交之后,我将用户重定向到第二个步骤表单。你知道吗
class UserStep2(CreateView):
model = UserMeta
fields = [
'auth', # This is the input that I want to autocomplete with url <pk>
'zip_code',
'city',
]
template_name = 'step2.html'
url(r'^user/create/step1/$', UserStep1.as_view(), name='step-1'),
url(r'^user/create/step2/(?P<pk>[0-9]+)/$', UserStep2.as_view(), name='step-2'),
我要通过考试用户id从第一步到第二步,并自动填充“auth”输入。。我该怎么做?你知道吗
如果需要在表单中执行几个步骤,请查看FormWizard。你知道吗
它是included in django<;=1.7
相关问题 更多 >
编程相关推荐