Gridi Show
222 subscribers
4 photos
1 video
20 files
153 links
Download Telegram
Channel name was changed to «Gridi for python»
Channel name was changed to «Gridi Show for python»
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.6.4/css/buttons.dataTables.min.css">


<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>


<script src="https://cdn.datatables.net/buttons/1.6.4/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.4/js/buttons.flash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.4/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.4/js/buttons.print.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#example').DataTable(
{
dom: 'Blfrtip',
buttons: [
{
extend: 'excelHtml5',
title: 'Excel MK',
text:'Export to Excel'
},
{
extend: 'csvHtml5',
title: 'CSV MK',
text: 'Export to CSV'
},
{
extend: 'pdfHtml5',
title: 'PDF MK',
className: 'btn_pdf',
text: 'Export to PDF'
},
]
} );

} );
</script>
Email Verification In Django project| email Verification during sign-up or registration of new users
for source code:
https://t.me/pythonmoms
settings.py
#EMAIL
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_POST = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER ='your email id '
EMAIL_HOST_PASSWORD ='enter your password'
-------------------------------------------------------------------------------


views.py
from django.contrib.sites.shortcuts import get_current_site
from django.utils.encoding import force_bytes
from django.utils.encoding import force_str
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.template.loader import render_to_string
from .tokens import account_activation_token
from django.contrib.auth.models import User
from django.core.mail import EmailMessage
from django.contrib.auth import get_user_model
from django.http import HttpResponse

def activate(request, uidb64, token):
User = get_user_model()
try:
uid = force_str(urlsafe_base64_decode(uidb64))
user = User.objects.get(pk=uid)
except(TypeError, ValueError, OverflowError, User.DoesNotExist):
user = None
if user is not None and account_activation_token.check_token(user, token):
user.is_active = True
user.save()
return HttpResponse('Thank you for your email confirmation. Now you can login your account.')
else:
return HttpResponse('Activation link is invalid!')

# REGISTER FUNCTION
def Register_user(request):
form=SignUpForm()
if request.method=='POST':
form=SignUpForm(request.POST)

if form.is_valid():
user = form.save(commit=False)
user.is_active = False
user.save()

current_site = get_current_site(request)
mail_subject = 'Activation link has been sent to your email id'
message = render_to_string('acc_active_email.html', {
'user': user,
'domain': current_site.domain,
'uid':urlsafe_base64_encode(force_bytes(user.pk)),
'token':account_activation_token.make_token(user),
})
to_email = form.cleaned_data.get('email')
email = EmailMessage(
mail_subject, message, to=[to_email]
)
email.send()
messages.success(request,"Please confirm your email address to complete the registration")
return redirect('home')

else:

form = SignUpForm()
return render(request, 'register.html', {'form': form})
return render(request, 'register.html')

urls.py
path('activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/',views.activate, name='activate'),
3👍1
In this video we are going to see how we can reset the password of user in django
for source code:https://t.me/pythonmoms
settings.py-------------------------

EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_POST = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER ='Enter your email id'
EMAIL_HOST_PASSWORD ='Enter your password'
urls.py------------------

from django.contrib.auth import views as auth_views
path('password_reset/', auth_views.PasswordResetView.as_view(template_name='password_reset_form.html'), name='password_reset'),
path('password_reset_done/', auth_views.PasswordResetDoneView.as_view(template_name='password_reset_done.html'), name='password_reset_done'),
path('password_reset_confirm/<uidb64>/<token>/',auth_views.PasswordResetConfirmView.as_view(template_name='password_reset_confirm.html'), name='password_reset_confirm'),
path('password_reset_complete/', auth_views.PasswordResetCompleteView.as_view(template_name='password_reset_complete.html'), name='password_reset_complete'),


password_reset_complete.html----------------

{% extends 'base.html' %}
{% block content %}
<p>
Your password has been set. You may go ahead and <a href="{% url 'home' %}">sign in</a> now.
</p>
{% endblock %}


password_reset_confirm.html------------
{% extends 'base.html' %}
{% block content %}
{% if validlink %}
<h3>Change password</h3>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Change password</button>
</form>
{% else %}
<p>
The password reset link was invalid, possibly because it has already been used.
Please request a new password reset.
</p>
{% endif %}
{% endblock %}


password_reset_done.html------------------

{% extends 'base.html' %}
{% block content %}
<p>
We've emailed you instructions for setting your password, if an account exists with the email you entered.
You should receive them shortly.
</p>
<p>
If you don't receive an email, please make sure you've entered the address you registered with,
and check your spam folder.
</p>
{% endblock %}

password_reset_form.html-----------------

{% extends 'base.html' %}
{% block content %}
<h3>Forgot password</h3>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Submit</button>
</form>
{% endblock %}



django documentation tutorial,
how to create django project in python,
how to add satic files in django,
django project for resume,
how to add html template in django,
django latest version tutorial,
how to create django project in visual studio code,
django project with source code,
django project for freshers,
how to host django project,
how to add html and css in django,
how to create project in django Session Time Out in django project|your session has expired please login again@gridi_durgesh
django framework Play list
django crash course
django project