Exemple #1
0
def home(request):
    if request.method == "POST":
        form = forms.SampleForm(request.POST, request.FILES)
        if form.is_valid():
            data = form.cleaned_data
            profile_pic = data['profile_pic']
            utilities.store_image(profile_pic)
            return HttpResponse(str(data))
    form = forms.SampleForm()
    return render(request, "app/sample1.html", {'form': form})
Exemple #2
0
def home(request):
    if request.method=="POST":
        form=forms.SampleForm(request.POST,request.FILES)
        if form.is_valid()==False:
            return render(request,"app/forms.html",{'form':form})
        else:
            data=form.cleaned_data
            profile_pic=data['profile_pic']
            utilities.store_image(profile_pic)
            print(form.cleaned_data)
    form=forms.SampleForm()
    return render(request,"app/forms.html",{'form':form})