def House(request):
if request.method == 'POST':
form = Hous(request.POST, request.FILES)
if form.is_valid():
print("is valid")
form.save()
redirect('/')
else:
return HttpResponse('dont save')
else:
form = Hous()
return render(request, 'front.html', {'form':form})
forms.py:
from django import forms
from .models import Hous
class Hous(forms.ModelForm):
class Meta:
model = Hous
fields ='__all__'