Re: Re: Re: I am filling up the form but my filled out items are not rendering into database and also the session is not working

2020-02-19 Thread DHRUVA
How can I do ImageField and FileField in crispy forms

On Thu, 20 Feb, 2020, 12:53 AM ,  wrote:

>
>
> Yaa did that still facing issue
>
>
>
> *From: *onlinejudge95 
> *Sent: *Thursday, February 20, 2020 12:32 AM
> *To: *django-users@googlegroups.com
> *Subject: *Re: Re: I am filling up the form but my filled out items are
> not rendering into database and also the session is not working
>
>
>
> The template file
>
>
>
>
>
> <*form **method**="post" **novalidate*>
>
> No action attribute defined here. Where do you expect the data to be sent?
>
>
> {% csrf_token %}
>
>   <*div **class**="form-group col-md-4 mb-0"*>
> {{ form.name|as_crispy_field }}
>   
>   <*div **class**="form-group col-md-4 mb-0"*>
> {{ form.email|as_crispy_field }}
>   
>   <*div **class**="form-group col-md-4 mb-0"*>
> {{ form.link_sent|as_crispy_field }}
>   
> <*button **type**="submit" **class**="btn btn-primary"*>Start
>  <*button **type**="submit" **class**="btn btn-primary"*>Save
>
>   
> {% endblock %}
>
>
>
>
>
> *From: *Farai M 
> *Sent: *Wednesday, February 19, 2020 11:19 PM
> *To: *django-users@googlegroups.com
> *Subject: *Re: I am filling up the form but my filled out items are not
> rendering into database and also the session is not working
>
>
>
> The session must be activated in the settings file check that it should
> work smoothly.
>
> On the insert can u share the template file mostly .It is to do with post
> requests not reaching back end. You can try to print the post request
> before your save to model to see if all inputs are coming through.If it's
> not that try get create to see if it's an problem with duplicates.
>
>
>
>
>
>
>
>
>
>
>
>
>
> *views.py from *django.views.generic *import *FormView, TemplateView
> *from *django.shortcuts *import *render,redirect
> *from *.models *import 
> *modelstep1,modelstep2,modelstep3,modelstep4,modelstep5,modelstep6,modelstep7,modelstep8,modelstep9,modelstep10
> *from *.forms *import 
> *FormStep1,FormStep2,FormStep3,FormStep4,FormStep5,FormStep6,FormStep7,FormStep8,FormStep9,FormStep10
>
> *def *FormStep1View(request):
> forms = FormStep1()
> *return *render(request, *'form_1.html'*, context={*'form'*: forms})
>
>
> *def *addForm1(request):
> form = FormStep1(request.POST)
> *if *form.is_valid():
> u=modelstep1()
> u.name = form.cleaned_data[*'name'*]
> u.email = form.cleaned_data[*'email'*]
> u.link_sent = form.cleaned_data[*'link_sent'*]
> u.title = request.POST.get(*'name'*)
> u.content = request.POST.get(*'email'*)
> u.content = request.POST.get(*'link_sent'*)
> u.save()
> request.session[*'name'*] = u.name
> request.session[*'email'*] = u.email
> request.session[*'link_sent'*] =u.link_sent
> *return *redirect(*'/form/2/'*,context={*'form'*: form})
>
>
>
> *def *FormStep2View(request):
> forms = FormStep2()
> *return *render(request, *'form_2.html'*, context={*'form'*: forms})
> *def *addForm2(request):
> form = FormStep2(request.POST)
> *if *form.is_valid():
>   v=modelstep2()
>   v.country=form.cleaned_data[*'country'*]
>   v.city=form.cleaned_data[*'city'*]
>   v.year_of_birth=form.cleaned_data[*'year_of_birth'*]
>   v.current_grade=form.cleaned_data[*'current_grade'*]
>   v.university=form.cleaned_data[*' university'*]
>   v.school=form.cleaned_data[*'school'*]
>   v.native_language=form.cleaned_data[*'native_language'*]
>   v.phone_number = form.cleaned_data[*'phone_number'*]
>   v.email_business=form.cleaned_data[*'email_business'*]
>   v.social_media=form.cleaned_data[*'social_media'*]
>
>   request.session[*'country'*] = v.country
>   request.session[*'city'*] = v.city
>   request.session[*'year_of_birth'*] = v.year_of_birth
>   request.session[*'current_grade'*] = v.current_grade
>   request.session[*'university'*] = v.university
>   request.session[*'school'*] = v.school
>   request.session[*'native_language'*] = v.native_language
>   request.session[*'phone_number'*] = v.phone_number
>   request.session[*'email_business'*] = v.email_business
>   request.session[*'social_media'*]=  v.social_media
>   *return *redirect(request, *'/form/3/'*, 
> context={*'form'*:form})
>
>
> *def *FormStep3View(request):
> forms = FormStep3()
> *return *render(request, *'form_3.html'*, context={*'form'*: forms})
> *def *addForm3(request):
> form = FormStep3(request.POST)
> *if *form.is_valid():
>x=modelstep3()
>x.internship_idea = form.cleaned_data[*'internship_idea'*]
>x.startup_business = form.cleaned_data[*'startup_business'*]
>x.goals = 

RE: Re: Re: I am filling up the form but my filled out items are not rendering into database and also the session is not working

2020-02-19 Thread dhruvashah1221999
 Yaa did that still facing issue From: onlinejudge95Sent: Thursday, February 20, 2020 12:32 AMTo: django-users@googlegroups.comSubject: Re: Re: I am filling up the form but my filled out items are not rendering into database and also the session is not working The template file  
No action attribute defined here. Where do you expect the data to be sent? {% csrf_token %} 
    {{ form.name|as_crispy_field }}  div> 
    {{ form.email|as_crispy_field }}  div> 
    {{ form.link_sent|as_crispy_field }}  div>