Re: User authentication with simple-jwt drf

2022-08-31 Thread Mobina J
hii 

import pandas as pd
from django.contrib import messages
from django.core.mail import EmailMessage
from django.shortcuts import render
from django.template.loader import render_to_string
from app_1.form import NotificationForm


def email_generic_template(request):
form = NotificationForm(request.POST)
if form.is_valid():
csv_file = request.FILES['file']
data = pd.read_csv(csv_file)
subj = request.POST.get('subject')
msg = request.POST.get('message')
BCC = request.POST.get('bcc_email')
CC = request.POST.get('cc_email')
answer = request.POST.get('selected_option')
demo = list()
try:
for k, r in data.iterrows():
value = r.to_dict()
recipient = value["email_id"]
Subject = subj.format(**value)
Body_of_message = msg.format(**value)
bcc = BCC.format(**value)
cc = CC.format(**value)
FROM_EMAIL = "exam...@gmail.com"
html_template = render_to_string('mail_template.html', {'content': 
Body_of_message})
email1 = EmailMessage(
Subject,
html_template,
FROM_EMAIL,
[recipient],
bcc=[bcc],
cc=[cc]
)
email1.content_subtype = 'html'
sent = email1.send()
value['sent'] = sent
demo.append(value)
if sent == 1:
sent = 'success'
print(sent)
else:
sent = 'Fail'
print(sent)
if answer == 'sample_mail':
break
context = {
'form': form,
'value': demo,
}
return render(request, 'index.html', context)
except Exception as e:
messages.error(request, e)
context = {
'form': form,
'value': demo
}
return render(request, 'index.html', context)

else:
context = {'form': form}
return render(request, 'index.html', context)
  



this is my code...I want to show failed mail to the template...I am new to 
Django I did not know how to do it. anyone  help me
On Wednesday, August 24, 2022 at 7:24:23 PM UTC+5:30 dashlaksh...@gmail.com 
wrote:

> Hello everyone,
> I want to create a user authentication app using ReactJS and django. But 
> facing problems in authenticating with the jsonwebtokens in ReactJS. Can 
> anybody provide correct guide of implementing DjangoRestFramework 
> simple-jwt and ReactJS jet ?
>

-- 



_Disclaimer: _© 2022 VVDN Technologies Pvt. Ltd. This e-mail contains 
PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the 
addressee(s). If you are not the intended recipient, please notify the 
sender by e-mail and delete the original message. Further, you are not to 
copy, disclose, or distribute this e-mail or its contents to any other 
person and any such actions are unlawful._
_
_
_
__

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/87302199-bf5f-4aae-bcaf-ab6ab2401c0fn%40googlegroups.com.


User authentication with simple-jwt drf

2022-08-24 Thread Lakshyaraj Dash
Hello everyone,
I want to create a user authentication app using ReactJS and django. But
facing problems in authenticating with the jsonwebtokens in ReactJS. Can
anybody provide correct guide of implementing DjangoRestFramework
simple-jwt and ReactJS jet ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF7qQgAP5MbmBLtEHpGWZ%3Dp9Uc_hc053T_BcxVQm%3D_7VMq9CxQ%40mail.gmail.com.