Please give me a reference to a full example of Form wizard.
To learn it I try to solve such an application (details are omitted):
urls.py:
urlpatterns = patterns('',
(r'^hotel_wizard/', 'my.app.views.hotel_info'),
models.py:
class Country(models.Model):
name = models.CharField(max_length=50)
objects = models.Manager()
class Region(models.Model):
name = models.CharField(max_length=50)
country = models.ForeignKey(Country)
objects = models.Manager()
class Hotel(models.Model):
name = models.CharField(max_length=255)
region = models.ManyToManyField(Region)
price = models.IntegerField()
objects = models.Manager()
forms.py:
class HotelForm1(forms.Form):
country = forms.ModelChoiceField(queryset=Country.objects.all())
class HotelForm2(forms.Form):
region = forms.ModelChoiceField(queryset=Region.objects.all()) ???
price = forms.DecimalField(max_digits=7)
class HotelWizard(FormWizard):
def done(self, request, form_list):
return HttpResponseRedirect('/page-to-redirect-to-when-done/')
I stopped at this step. How can I pass country selected to HotelForm2
and use it in queryset, and so on.
Maybe the best way for me is to look at an example. I didn't find it
in
djangoproject.com and 3 books on Django I have.
Thank you!