Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def delete_recevier_message(request):
username = request.session.get('user', '')
emails = Email.objects.all()
if request.method =="POST":
email_id = request.POST.get("id")
Email.objects.filter(email_id=email_id).delete()
return render(request, "email_add_page.html", {"user": username, "emails": emails})
def edit_recevier_message(request):
username = request.session.get('user', '')
emails = Email.objects.all()
if request.method =="POST":
id = request.POST.get("id")
edit_sender_email_site = request.POST.get("edit_sender_email_site")
edit_recevier_email_sites = request.POST.get("edit_recevier_email_sites")
edit_email_subject = request.POST.get("edit_email_subject")
edit_recevier_email_port = request.POST.get("edit_recevier_email_port")
edit_email_body = request.POST.get("edit_email_body")
Email.objects.filter(email_id=id).update(sender=edit_sender_email_site, receivers=edit_recevier_email_sites, body=edit_email_body,
email_port=edit_recevier_email_port, subject=edit_email_subject)
return render(request,"email_add_page.html",{"user": username,"emails": emails})
def add_email_recevier(request):
username = request.session.get('user', '')
emails = Email.objects.all()
if request.method == "POST":
sender_email_site = request.POST.get("sender_email_site")
recevier_email_sites = request.POST.get("recevier_email_sites")
email_subject = request.POST.get("email_subject")
recevier_email_port = request.POST.get("recevier_email_port")
email_body = request.POST.get("email_body")
Email.objects.create(sender=sender_email_site,receivers=recevier_email_sites,body=email_body,email_port=recevier_email_port,subject=email_subject)
return render(request,"email_add_page.html",{"user": username,"emails": emails})