| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/allstaterealty/tamerproperty/realestate/ |
Upload File : |
from django.shortcuts import render
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.http import HttpResponseRedirect, HttpResponse
from django.urls import reverse
from django.contrib.auth.decorators import login_required
from django.db import models
from cms.models import Page
from crm.models import ContactUs
from .forms import ContactForm
from django.core.mail import send_mail
def home(request):
return render(request, 'home/home.html', {})
""" if request.method == 'POST':
username = request.POST.get('username')
password = request.POST.get('password')
user = authenticate(request, username=username, password=password)
if user:
if user.is_active:
login(request, user)
return HttpResponseRedirect(reverse('dashboardindex'))
else:
return HttpResponse("Your account was inactive.")
else:
print("Someone tried to login and failed.")
print("They used username: {} and password: {}".format(
username, password))
return HttpResponse("Invalid login details given")
else:
return render(request, 'home.html', {}) """
def about_us(request):
data = Page.objects.filter(id='2')
return render(request, 'about_us/about_us.html', {'data': data})
def contactus(request):
submitted = False
form= ContactForm(request.POST or None)
if request.method == "POST":
errors = None
if form.is_valid():
ContactUs.objects.create(
Name = form.cleaned_data.get('name'),
Email = form.cleaned_data.get('email'),
MobileNo = form.cleaned_data.get('phone'),
CountryCode='+91',
Message = form.cleaned_data.get('comment'),
Subject = form.cleaned_data.get('subject'),
WebsiteSysId=form.cleaned_data.get('WebsiteSysId'),
)
return HttpResponseRedirect('/contactus?submitted=True')
if form.errors:
errors = form.errors
context = {"form": form, "errors": errors}
return render(request, 'contact_us/contactus.html',context)
else:
form = ContactForm()
if 'submitted' in request.GET:
submitted = True
context= {'form': form,'submitted': submitted}
return render(request, 'contact_us/contactus.html',context)
def termandconditions(request):
termandconditions = Page.objects.filter(id='1')
return render(request, 'term_conditions/termandconditions.html', {'data': termandconditions})
def privacypolicy(request):
privacypolicy = Page.objects.filter(id='7')
return render(request, 'privacy_policy/privacy_policy.html', {'data': privacypolicy})
def allcontent(request,id):
contentdata = Page.objects.filter(id=id)
return render(request, 'contentpage/allcontent.html', {'data': contentdata})
def signout(request):
logout(request)
return HttpResponseRedirect('/')