| def add_user(request): |
| create_user = UserCreationForm(request.POST or None) |
| if request.method == 'POST' and create_user.is_valid(): |
| create_user.save() |
| return redirect(reverse('schoolprofile1')) |
| |
| return render( request, 'create_user_form.html', |
| {'create_user': create_user, |
| }) |
|
|
|
|
|
|
| def schoolprofile1(request): |
| school_info = SchoolsForm(request.POST or None ) |
| if request.method == 'POST' and school_info.is_valid(): |
| request.session['school_data'] = school_info.cleaned_data |
| return redirect(reverse('schoolprofile2')) |
|
|
| return render(request, 'schoolprofile1.html',{ |
| 'school_info': school_info, |
| }) |
|
|
|
|
| def schoolprofile2(request): |
| school_info_two = SchoolDataForm(request.POST) |
| if request.method == 'POST' and school_data.is_valid(): |
| complete_school_data_ = { |
| **request.session['school_data'], |
| **school_info_two.cleaned_data |
| } |
| Schools.object.create(**complete_school_data) |
|
|
| return redirect('schoolDetail') |
|
|
| return render(request, 'schoolprofile2.html',{ |
| 'school_data':school_info_two, |
| urlpatterns = [ |
| path('', views.index, name = 'index'), |
| path('schoolprofile/step-two', views.schoolprofile2, name='schoolprofile2'), |
| path('schoolprofile/step-one', views.schoolprofile1, name = 'schoolprofile1'), |
| path('schoolprofile/add-user', views.add_user, name= 'add_user'), |
| path('schoolprofile', views.add_school, name='add_school'), |
| #path(r'ProfileYourSchool', add_School.as_view([profileForm, SchoolsForm, schoolDataForm]), name = 'add_Schools'), |
| path(r'ContactUs', views.Contact, name = 'Contact'), |
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHLKn73kTShkC7NsertLBbvrMnDp%3DJNQ0w2_iN41s-fVDiyRHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%2Be-ZVDX%2BdzyJ4fJ2L7sKvDsDaOWJYKjUfRGTsROtGyxcEBwQ%40mail.gmail.com.