这是我在StackOverflow上的第一个问题,请原谅我的错误。在
现在,回答这个问题!在
我目前正在django制作网站,它有多个模型链接到一个父模型。现在我想创建一个包含所有这些模型的多页表单。怎么做???在
具体问题如下:
模型.py
class Profile(models.Model):
user = models.OneToOneField(User)
first_name = odels.CharField(
max_length=255, validators=ONLY_LETTERS_VALIDATOR)
last_name = odels.CharField(
max_length=255, validators=ONLY_LETTERS_VALIDATOR)
# And some other fields
class YMHTMobile(models.Model):
profile = models.ForeignKey(Profile)
mobile = models.CharField(max_length=10, validators=ONLY_DIGITS_VALIDATOR)
is_active = models.BooleanField(default=True)
def __unicode__(self):
return '%s' % self.mobile
class Meta:
verbose_name_plural = 'Mobile Details'
# some more models with foreign key as profile
现在,我想创建一个包含所有这些模型的多页表单(比如一个页面中的一个模型表单,然后单击next以获得另一个表单)
我该怎么做??在
使用Form Wizardcontrib应用程序。在
更新:表单向导已从Django1.8移到单独的项目-Django Form Tools。在
相关问题 更多 >
编程相关推荐