Compare commits
4 Commits
f0c76bd05b
...
04c4b04ba9
Author | SHA1 | Date |
---|---|---|
|
04c4b04ba9 | |
|
ebec31e61a | |
|
2531e880a7 | |
|
d0f9b2a093 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -3,3 +3,4 @@ from .models import *
|
|||
admin.site.register(emails_creadentials)
|
||||
admin.site.register(auto_email_function_errors)
|
||||
admin.site.register(Mnf_Notification)
|
||||
admin.site.register(Member_News)
|
||||
|
|
|
@ -2,4 +2,5 @@ from django.apps import AppConfig
|
|||
|
||||
|
||||
class AutoEmailConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'auto_email'
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,48 @@
|
|||
# Generated by Django 4.1.13 on 2024-04-08 05:13
|
||||
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='auto_email_function_errors',
|
||||
fields=[
|
||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('email', models.EmailField(blank=True, max_length=254, null=True)),
|
||||
('error', models.TextField(blank=True, null=True)),
|
||||
('email_code', models.CharField(blank=True, max_length=150, null=True)),
|
||||
('key_value', models.TextField(blank=True, null=True)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='emails_creadentials',
|
||||
fields=[
|
||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('email', models.EmailField(blank=True, max_length=254, null=True)),
|
||||
('password', models.CharField(blank=True, max_length=250, null=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Mnf_Notification',
|
||||
fields=[
|
||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('user', models.CharField(max_length=100)),
|
||||
('read', models.BooleanField(default=False)),
|
||||
('title', models.CharField(blank=True, max_length=200, null=True)),
|
||||
('service_name', models.CharField(blank=True, max_length=200, null=True)),
|
||||
('image_url', models.CharField(blank=True, max_length=200, null=True)),
|
||||
('created', models.DateTimeField(auto_now_add=True, null=True)),
|
||||
('updated', models.DateTimeField(auto_now=True, null=True)),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 4.1.13 on 2024-07-05 10:43
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auto_email', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='mnf_notification',
|
||||
name='content',
|
||||
field=models.CharField(blank=True, max_length=800, null=True),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,28 @@
|
|||
# Generated by Django 4.1.13 on 2024-12-31 11:02
|
||||
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auto_email', '0002_mnf_notification_content'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Member_News',
|
||||
fields=[
|
||||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||
('user', models.CharField(max_length=100)),
|
||||
('read', models.BooleanField(default=False)),
|
||||
('title', models.CharField(blank=True, max_length=200, null=True)),
|
||||
('content', models.CharField(blank=True, max_length=800, null=True)),
|
||||
('service_name', models.CharField(blank=True, max_length=200, null=True)),
|
||||
('image_url', models.CharField(blank=True, max_length=200, null=True)),
|
||||
('created', models.DateTimeField(auto_now_add=True, null=True)),
|
||||
('updated', models.DateTimeField(auto_now=True, null=True)),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 4.1.13 on 2025-01-02 11:29
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auto_email', '0003_member_news'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='member_news',
|
||||
name='title',
|
||||
field=models.CharField(blank=True, max_length=800, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='mnf_notification',
|
||||
name='title',
|
||||
field=models.CharField(blank=True, max_length=800, null=True),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 4.1.13 on 2025-03-08 11:44
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('auto_email', '0004_alter_member_news_title_alter_mnf_notification_title'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='mnf_notification',
|
||||
options={'ordering': ['-updated']},
|
||||
),
|
||||
]
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -24,9 +24,27 @@ class Mnf_Notification(models.Model):
|
|||
id = models.UUIDField(primary_key=True,editable=False,default=uuid.uuid4)
|
||||
user = models.CharField(max_length=100)
|
||||
read = models.BooleanField(default = False)
|
||||
title = models.CharField(max_length = 200,blank=True, null=True)
|
||||
title = models.CharField(max_length = 800,blank=True, null=True)
|
||||
content = models.CharField(max_length = 800,blank=True, null=True)
|
||||
service_name = models.CharField(max_length = 200,blank=True, null=True)
|
||||
image_url = models.CharField(max_length = 200,blank=True, null=True)
|
||||
created = models.DateTimeField(auto_now_add=True,blank=True, null=True)
|
||||
updated = models.DateTimeField(auto_now=True,blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ['-updated']
|
||||
|
||||
def __str__(self):
|
||||
return self.user
|
||||
|
||||
|
||||
class Member_News(models.Model):
|
||||
id = models.UUIDField(primary_key=True,editable=False,default=uuid.uuid4)
|
||||
user = models.CharField(max_length=100)
|
||||
read = models.BooleanField(default = False)
|
||||
title = models.CharField(max_length = 800,blank=True, null=True)
|
||||
content = models.CharField(max_length = 800,blank=True, null=True)
|
||||
service_name = models.CharField(max_length = 200,blank=True, null=True)
|
||||
image_url = models.CharField(max_length = 200,blank=True, null=True)
|
||||
created = models.DateTimeField(auto_now_add=True,blank=True, null=True)
|
||||
updated = models.DateTimeField(auto_now=True,blank=True, null=True)
|
|
@ -5,3 +5,35 @@ class Mnf_NotificationSerializer(serializers.ModelSerializer):
|
|||
class Meta:
|
||||
model = Mnf_Notification
|
||||
fields = '__all__'
|
||||
|
||||
class Member_NewsSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Member_News
|
||||
fields = '__all__'
|
||||
class Mnf_getNews(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Mnf_Notification
|
||||
fields = '__all__'
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
replacement_name = self.context.get('replacement_name', 'User')
|
||||
|
||||
# Define a reusable replacement function
|
||||
def replace_words(text,name):
|
||||
if not text:
|
||||
return text
|
||||
# Perform replacements
|
||||
text = text.replace("your", f"{name}'s").replace("Your", f"{name}'s")
|
||||
text = text.replace("you", name).replace("You", name)
|
||||
return text
|
||||
|
||||
# Update 'title' field
|
||||
if 'title' in representation:
|
||||
representation['title'] = replace_words(representation['title'],replacement_name)
|
||||
|
||||
# Update 'content' field
|
||||
if 'content' in representation:
|
||||
representation['content'] = replace_words(representation['content'],replacement_name)
|
||||
|
||||
return representation
|
||||
|
|
|
@ -11,14 +11,16 @@
|
|||
</style>
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif;font-size: 16px;">
|
||||
<div style="max-width: 70vw; box-shadow: 0px 4px 27px 0px #00000040; margin: 16px auto;">
|
||||
<div style="max-width: 100vw; box-shadow: 0px 4px 27px 0px #00000040; margin: 16px auto;">
|
||||
<img src="https://uidemos.s3.ap-south-1.amazonaws.com/v2_512.png" style="width: 100%;">
|
||||
<!-- <h1 style="font-size: 18px; font-weight: 700; text-align: center; margin: auto; color: #33B0CA;">CONGRATULATIONS! <br>Your Premise is now live!!!</h1> -->
|
||||
<h1 style="font-size: 1.25em; font-weight: 800; text-align: center; margin: auto; color: #33B0CA;"><b>{{title1}}</b></h1>
|
||||
<h2 style="font-size: 1.25em; font-weight: 800; text-align: center; margin: auto; color: #33B0CA;"><b>{{title2}}<br></b></h2>
|
||||
<div style="padding: 28px">
|
||||
<div style="text-align: center;">
|
||||
<a href="{{ doodlelink }}" target="_blank">
|
||||
<img src="{{ doodleurl }}" style="width: 235px; height: 245px;">
|
||||
</a>
|
||||
</div>
|
||||
<article>
|
||||
<!-- <h2 style="font-size: 16px; font-weight: 500; color: #252525; margin-bottom: 16px;">Dear {{User}},</h2>
|
||||
|
@ -31,11 +33,15 @@
|
|||
{% load custom_filters %}
|
||||
{% with pattern="\[(.*?)\]\((.*?)\)" %}
|
||||
{% with modified_value=invitation|urlize_text|safe %}
|
||||
<p>{{ modified_value|safe }}</p>
|
||||
<div>{{ modified_value|safe }}</div>
|
||||
{% endwith %}
|
||||
{% if additional %}
|
||||
{% with modified_value=additional|urlize_text|safe %}
|
||||
<p>{{ modified_value|safe }}</p>
|
||||
<p style:"text-align:center;">{{ modified_value|safe }}</p>
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
<p></p>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</article>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
<style>
|
||||
body,
|
||||
table,
|
||||
td,
|
||||
a {
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
table,
|
||||
td {
|
||||
mso-table-lspace: 0pt;
|
||||
mso-table-rspace: 0pt;
|
||||
}
|
||||
|
||||
img {
|
||||
-ms-interpolation-mode: bicubic;
|
||||
}
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
height: auto;
|
||||
line-height: 100%;
|
||||
outline: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse !important;
|
||||
}
|
||||
|
||||
body {
|
||||
height: 100% !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
a[x-apple-data-detectors] {
|
||||
color: inherit !important;
|
||||
text-decoration: none !important;
|
||||
font-size: inherit !important;
|
||||
font-family: inherit !important;
|
||||
font-weight: inherit !important;
|
||||
line-height: inherit !important;
|
||||
}
|
||||
|
||||
div[style*="margin: 16px 0;"] {
|
||||
margin: 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body style="background-color: #f7f5fa; margin: 0 !important; padding: 0 !important;">
|
||||
{% block message %}
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td bgcolor="#33B0CA" align="center">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="480">
|
||||
<tr>
|
||||
<td align="center" valign="top" style="padding: 40px 10px 20px 10px;">
|
||||
<div style="display: block; font-family: Helvetica, Arial, sans-serif; color: #ffffff; font-size: 25px;"border="0"><b>My Next Film</b></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#33B0CA" align="center" style="padding: 0px 10px 0px 10px;">
|
||||
<table border="0" cellpadding="5" cellspacing="0" width="480" style="width: 60%">
|
||||
<tr>
|
||||
<td bgcolor="#ffffff" align="center" valign="top" style="border-radius:4px 4px 0px 0px; color: #111111; font-family: Helvetica, Arial, sans-serif; font-size: 48px; font-weight: 400; line-height: 48px;">
|
||||
<h1 style="font-size: 25px; font-weight: 400;font-family: Helvetica, Arial, sans-serif; margin: 0; color: #ee3c4d;"><b>{{title1}}</b></h1>
|
||||
<h2 style="font-size: 22px; font-weight: 400;font-family: Helvetica, Arial, sans-serif; margin: 0; color: #ee3c4d;"><b>{{title2}}<br></b></h2>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="480" style="width: 60%">
|
||||
<tr>
|
||||
<td bgcolor="#ffffff" align="left">
|
||||
<table width="100%" border="0" cellspacing="10" cellpadding="1" padding:"5px">
|
||||
<tr>
|
||||
<td style="padding:20px;">
|
||||
{% load custom_filters %}
|
||||
{% with pattern="\[(.*?)\]\((.*?)\)" %}
|
||||
{% with modified_value=invitation|urlize_text|safe %}
|
||||
<p>{{ modified_value|safe }}</p>
|
||||
{% endwith %}
|
||||
{% with modified_value=additional|urlize_text|safe %}
|
||||
<p>{{ modified_value|safe }}</p>
|
||||
{% endwith %}
|
||||
{% endwith %}
|
||||
<br>
|
||||
<br>
|
||||
<a href="{{pageurl}}"><img src="{{poster}}" alt="{{poster}}" style="max-width:100%;height:auto;" ></a>
|
||||
<br>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor="#ffffff" align="center">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td bgcolor="#ffffff" align="center"
|
||||
style="padding: 30px 30px 30px 30px; border-top:1px solid #dddddd;">
|
||||
<table border="0" cellspacing="0" cellpadding="0" style= "margin-top:-25px">
|
||||
<tr>
|
||||
<td bgcolor="" align="left"
|
||||
style="color: #666666; font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;">
|
||||
<p style="margin: 0;">For any related queries, please reach out to ."<a href="mailto:support@mynextfilm.ai" target="_blank"
|
||||
style="color: #111111; font-weight: 700;">MY NEXT FILM PRIVATE LIMITED<a>".</p><div style="opacity:0.05">{{emailcode}}<div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endblock message %}
|
||||
</body>
|
0
kitchen_counter/auto_email/templatetags/__pycache__/__init__.cpython-311.pyc
Normal file → Executable file
0
kitchen_counter/auto_email/templatetags/__pycache__/__init__.cpython-311.pyc
Normal file → Executable file
Binary file not shown.
Binary file not shown.
BIN
kitchen_counter/auto_email/templatetags/__pycache__/custom_filters.cpython-311.pyc
Normal file → Executable file
BIN
kitchen_counter/auto_email/templatetags/__pycache__/custom_filters.cpython-311.pyc
Normal file → Executable file
Binary file not shown.
Binary file not shown.
|
@ -6,5 +6,16 @@ register = template.Library()
|
|||
|
||||
@register.filter
|
||||
def urlize_text(value):
|
||||
if not value:
|
||||
return ""
|
||||
url_pattern = re.compile(r'\[([^]]+)\]\(([^)]+)\)')
|
||||
print("##############",value,"###############")
|
||||
if "Register" in value and "Embrace" in value:
|
||||
matches = re.findall(r"\[([^\]]+)]\(([^)]+)\)", value)
|
||||
sender_name, sender_url = matches[0]
|
||||
receiver_name, receiver_url = matches[1]
|
||||
return f''' <p style="text-align: center; font-size:34px;"> <a href="{sender_url}" target="_blank">{sender_name}</a> to <a href="{receiver_url}" target="_blank">{receiver_name}</a> </p> '''
|
||||
elif "Embrace" in value or "Message" in value or "Masterpiece" in value:
|
||||
return mark_safe(url_pattern.sub(r'<table width="100%" cellspacing="0" cellpadding="0" style="text-align: center;"> <tr> <td align="center"> <a href="\2" style="display: inline-block; padding: 10px 20px; font-size: 34px; border-radius: 5px;">\1</a> </td> </tr></table>', value))
|
||||
|
||||
return mark_safe(url_pattern.sub(r'<a href="\2">\1</a>', value))
|
|
@ -8,6 +8,6 @@ urlpatterns = [
|
|||
|
||||
path('mnfnotification/', views.mnf_notification, name="mnfnotification"),
|
||||
path('mnfnotification/<str:pk>/', views.mnf_notification, name="mnfnotification"),
|
||||
|
||||
path('getnews/<str:pk>/', views.getNews, name="getnews"),
|
||||
|
||||
]
|
||||
|
|
|
@ -1,32 +1,23 @@
|
|||
from .models import *
|
||||
from .serializer import *
|
||||
from .serializers import *
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.decorators import (api_view, authentication_classes,
|
||||
permission_classes)
|
||||
from rest_framework_simplejwt.authentication import JWTAuthentication
|
||||
from rest_framework.permissions import AllowAny, IsAuthenticated
|
||||
from django.core.mail import EmailMultiAlternatives
|
||||
from django.utils.html import strip_tags
|
||||
from django.template.loader import render_to_string
|
||||
from django.conf import settings
|
||||
from MNF.settings import BasePath
|
||||
from django.core.mail import send_mail , get_connection
|
||||
from payment.models import privilegedUser1
|
||||
from django.contrib.auth.models import User
|
||||
#from viewerLounge.models import VideoIntroduction
|
||||
from lpp.models import MNFLPPDDatabase
|
||||
#from harkat.models import HarkatClubDatabase
|
||||
from mnfapp.models import centralDatabase
|
||||
import os
|
||||
from threading import Thread
|
||||
import pandas as pd
|
||||
from auto_email.models import emails_creadentials , auto_email_function_errors
|
||||
from MNF.settings import BasePath
|
||||
from users.models import UserCredentialsForBlockchain
|
||||
#from ScriptPad2.models import SPProject
|
||||
from scriptAudit.models import ScriptAuditModel
|
||||
#from ideamall2.models import Premise
|
||||
from mnfapp.models import ReferUser
|
||||
import MNF.settings as setting
|
||||
from django.conf import settings
|
||||
import re
|
||||
|
||||
|
||||
basepath = BasePath()
|
||||
|
@ -40,8 +31,8 @@ def newfunc(list):
|
|||
|
||||
def poster(user,email_code=None):
|
||||
try:
|
||||
data = User.objects.filter(email = user).values()
|
||||
id = data[0]['id']
|
||||
# data = User.objects.filter(email = user).values()
|
||||
# id = data[0]['id']
|
||||
if email_code.startswith("MR"):
|
||||
return '1'
|
||||
elif email_code.startswith("IM"):
|
||||
|
@ -58,8 +49,8 @@ def poster(user,email_code=None):
|
|||
return '7'
|
||||
elif email_code.startswith("ID"):
|
||||
return '8'
|
||||
# elif email_code.startswith("ID"):
|
||||
# return '9'
|
||||
elif email_code.startswith("IP"):
|
||||
return '9'
|
||||
elif email_code.startswith("GT"):
|
||||
return '10'
|
||||
elif email_code.startswith("RM"):
|
||||
|
@ -74,6 +65,12 @@ def poster(user,email_code=None):
|
|||
return '15'
|
||||
elif email_code.startswith("VW"):
|
||||
return '16'
|
||||
elif email_code.startswith("JP"):
|
||||
return '18'
|
||||
elif email_code.startswith("SS"):
|
||||
return '19'
|
||||
elif email_code.startswith("PB"):
|
||||
return '3'
|
||||
else :
|
||||
pass
|
||||
except Exception as e:
|
||||
|
@ -92,12 +89,12 @@ def mailer(all_email,email_code,key_value,filePath):
|
|||
name = centralDatabase.objects.filter(email = to_email)
|
||||
if name.exists():
|
||||
name = name[0]
|
||||
userName = name.firstName if name.firstName else name.email
|
||||
userName = name.firstName.capitalize() if name.firstName else name.email
|
||||
except:
|
||||
name = User.objects.filter(email = to_email)
|
||||
if name.exists():
|
||||
name = name[0]
|
||||
userName = name.first_name if name.first_name else name.email
|
||||
userName = name.first_name.capitalize() if name.first_name else name.email
|
||||
except:
|
||||
userName = to_email
|
||||
key_value.update({"User":userName})
|
||||
|
@ -106,131 +103,264 @@ def mailer(all_email,email_code,key_value,filePath):
|
|||
s1 = slice(0, 2)
|
||||
string = email_code[s1]
|
||||
value = fileexcel[fileexcel['sheet code'] == string]
|
||||
|
||||
if len(value) <= 0:
|
||||
auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code does not match with any sheet ")
|
||||
return print(('Email code does not match with any sheet'))
|
||||
sheet_name = value.iloc[0, 1]
|
||||
file_path = f"{basepath}/auto_email/email/EMAILSheet39.xlsx"
|
||||
|
||||
file_path = f"{basepath}/auto_email/email/EMAILSheet40.xlsx"
|
||||
file = pd.read_excel(file_path, sheet_name=sheet_name, header=1)
|
||||
row_data = file[file['Email Code'] == str(email_code)]
|
||||
if len(row_data) <= 0:
|
||||
auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="Email code is not present in any sheet")
|
||||
return print('Email code is not present in any sheet')
|
||||
row_data = row_data.fillna('')
|
||||
#from_email = row_data.iloc[0, 3]
|
||||
from_email = 'noreply@mynextfilm.ai'
|
||||
if row_data.iloc[0,7]:
|
||||
additional_option_code = row_data.iloc[0, 7]
|
||||
print(additional_option_code,"option code")
|
||||
option_file = pd.read_excel(
|
||||
file_path, sheet_name='Common Options', header=1)
|
||||
option_details = option_file[option_file['CODE'] == str(
|
||||
additional_option_code)]
|
||||
if len(option_details) <= 0:
|
||||
auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error='options code does not match with sheet options code')
|
||||
return print('options code does not match with sheet options code')
|
||||
poster_file = pd.read_excel(file_path, sheet_name='poster', header=1)
|
||||
poster_code = poster(user=to_email,email_code = email_code)
|
||||
postercode = 'P'+str(poster_code)
|
||||
if poster_code == '11':
|
||||
auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="user has not any priority to send poster")
|
||||
return print('user has not any priority to send poster')
|
||||
poster_url = poster_file[poster_file['Poster code'] == str(postercode)]
|
||||
posterurl = poster_url.iloc[0, 2]
|
||||
page_url = poster_url.iloc[0,3]
|
||||
doodle_url = poster_url.iloc[0,4]
|
||||
value = option_details['Language of the option'].iloc[0]
|
||||
print(value,"fkjsdljfsl")
|
||||
try:
|
||||
match = re.search(r'\((.*?)\)', str(value))
|
||||
if match:
|
||||
value_in_parentheses = match.group(1)
|
||||
else:
|
||||
value_in_parentheses="#"
|
||||
except:
|
||||
value_in_parentheses="#"
|
||||
print(option_details)
|
||||
else:
|
||||
value_in_parentheses="#"
|
||||
|
||||
# if len(option_details) <= 0:
|
||||
# auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error='options code does not match with sheet options code')
|
||||
# return print('options code does not match with sheet options code')
|
||||
|
||||
# poster_file = pd.read_excel(file_path, sheet_name='poster', header=1)
|
||||
# poster_code = poster(user=to_email,email_code = email_code)
|
||||
# postercode = 'P'+str(poster_code)
|
||||
# print("POSTER CODE:---------------",postercode)
|
||||
|
||||
# if poster_code == '11':
|
||||
# auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error="user has not any priority to send poster")
|
||||
# return print('user has not any priority to send poster')
|
||||
|
||||
# poster_url = poster_file[poster_file['Poster code'] == str(postercode)]
|
||||
# posterurl = poster_url.iloc[0, 2]
|
||||
# page_url = poster_url.iloc[0,3]
|
||||
# doodle_url = poster_url.iloc[0,4]
|
||||
# print("poster id ##########################8888888#")
|
||||
if row_data.iloc[0, 4]:
|
||||
doodle_url = str(row_data.iloc[0, 12])
|
||||
posterurl = str(row_data.iloc[0, 13])
|
||||
|
||||
dic_subject = str(row_data.iloc[0, 4]).replace('{}','').format_map(key_value)
|
||||
dic_invitation = str(row_data.iloc[0, 6]).replace('{}','').format_map(key_value)
|
||||
if len(option_details) <= 0:
|
||||
dic_additional=None
|
||||
else:
|
||||
dic_additional = str(option_details.iloc[0, 2]).replace('{}','').format_map(key_value)
|
||||
|
||||
title = str(row_data.iloc[0, 5]).replace('{}','').format_map(key_value).split('/')
|
||||
print("title", title)
|
||||
|
||||
message = {'subject': dic_subject,
|
||||
'title1': title[0],
|
||||
'title2': title[1],
|
||||
'invitation':dic_invitation,
|
||||
'additional': dic_additional,
|
||||
'poster': posterurl,
|
||||
'pageurl':page_url,
|
||||
'doodlelink':value_in_parentheses,
|
||||
'doodleurl':doodle_url,
|
||||
'emailcode':email_code
|
||||
}
|
||||
msg_html = render_to_string('email_template.html', message)
|
||||
excel_file = f"{basepath}/auto_email/email/EmailCredentials.xlsx"
|
||||
details = pd.read_excel(excel_file)
|
||||
email_data = details[details['email'] == str(from_email)]
|
||||
host = email_data.iloc[0, 1]
|
||||
port = int(email_data.iloc[0, 2])
|
||||
password = emails_creadentials.objects.get(email=from_email)
|
||||
print("before connection")
|
||||
#connection = get_connection(host=host,port=port,username=from_email,password=password.password,use_tls=True)
|
||||
from_email1 = "mynextfilm <noreply@mynextfilm>"
|
||||
|
||||
# send_mail(message['subject'],title[1],from_email=from_email,recipient_list=[to_email],html_message=msg_html,connection=connection)
|
||||
sendMail = EmailMultiAlternatives(message['subject'],title[1],from_email1,[to_email])
|
||||
print("after connection")
|
||||
print(message['subject'],'------------------',dic_invitation,dic_additional)
|
||||
from_email = settings.EMAIL_HOST_USER_NAME
|
||||
sendMail = EmailMultiAlternatives(message['subject'],title[1],from_email,[to_email])
|
||||
sendMail.attach_alternative(msg_html,"text/html")
|
||||
if filePath is not None:
|
||||
sendMail.attach_file(f'{filePath}')
|
||||
# if sheet_name == "Rendz (traction)":
|
||||
# notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/build_team.png")
|
||||
# elif sheet_name == "membershipReferences":
|
||||
# notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/pitchdeck.png")
|
||||
# elif sheet_name == "Misc.":cd
|
||||
# notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name,image_url = "/media/Notification_image/ideamall.png")
|
||||
if "Idea Mall" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Idea Mall",image_url = "/static/Notification_image/Idea_Mall.png")
|
||||
elif "Conversion - LPP" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion - LPP",image_url = "/static/Notification_image/Conversion_LPP.png")
|
||||
elif "Script Builder" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Builder",image_url = "/static/Notification_image/Script_Builder.png")
|
||||
elif "Messiah" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Messiah",image_url = "/static/Notification_image/Messiah.png")
|
||||
elif "Project Centre" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Project Centre",image_url = "/static/Notification_image/Project_Centre.png")
|
||||
elif "Harkat" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Harkat",image_url = "/static/Notification_image/Harkat.png")
|
||||
elif "Pitchdeck Bundle" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Pitchdeck Bundle",image_url = "/static/Notification_image/Pitchdeck_Bundle.png")
|
||||
elif "Script page" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Script Page",image_url = "/static/Notification_image/Script_page.png")
|
||||
elif "subtitle" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Subtitle",image_url = "/static/Notification_image/subtitle.png")
|
||||
elif "script pad" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "script pad",image_url = "/static/Notification_image/scriptpad.png")
|
||||
elif "narration" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Narration",image_url = "/static/Notification_image/narration.png")
|
||||
elif "Institutional Membership" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Institutional Membership",image_url = "/static/Notification_image/Institutional_Membership.png")
|
||||
elif "LPP - Admininstration" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "LPP - Admininstration",image_url = "/static/Notification_image/LPP_Admininstration.png")
|
||||
elif "Conversion ppt" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Conversion PPT",image_url = "/static/Notification_image/Conversion_ppt.png")
|
||||
elif "viewers lounge" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Viewers Lounge",image_url = "/static/Notification_image/viewers_lounge.png")
|
||||
elif "Ask a question" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Ask a question",image_url = "/static/Notification_image/subtitle.png")
|
||||
elif "Payment" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Payment",image_url = "/static/Notification_image/payment.png")
|
||||
elif "blockchain" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "blockchain",image_url = "/static/Notification_image/blockchain.png")
|
||||
elif "Sheet14" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Sheet14",image_url = "/static/Notification_image/subtitle.png")
|
||||
elif "Institutional Membership" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "Institutional Membership",image_url = "/static/Notification_image/subtitle.png")
|
||||
elif "membershipReferences" in sheet_name:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = "membershipReferences",image_url = "/static/Notification_image/subtitle.png")
|
||||
else:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=title[1],service_name = sheet_name)
|
||||
# from plyer import notification
|
||||
# notification.notify(title = sheet_name,message = title[1],timeout=100,app_icon = f'{basepath}/media/Notification_image/Conversion_ppt.png',app_name=sheet_name )
|
||||
print('mnf_not')
|
||||
mnf_notification.save()
|
||||
print("sendmail1")
|
||||
print("before send mail")
|
||||
sendMail.send()
|
||||
|
||||
print('done compete notification')
|
||||
try:
|
||||
sendMail.send()
|
||||
print("mail sent")
|
||||
except Exception as e:
|
||||
auto_email_function_errors.objects.create(
|
||||
email=to_email,
|
||||
email_code=email_code,
|
||||
key_value=key_value,
|
||||
error=f"Failed to send email: {str(e)}"
|
||||
)
|
||||
print(f"Error while sending email to {to_email}: {e}")
|
||||
|
||||
|
||||
notification_title=False
|
||||
news=False
|
||||
if row_data.iloc[0, 10]:
|
||||
notification_title = str(row_data.iloc[0, 10]).replace('{}','').format_map(key_value)
|
||||
if row_data.iloc[0, 11]:
|
||||
news = str(row_data.iloc[0, 11]).replace('{}','').format_map(key_value)
|
||||
print("dgdfd",notification_title,news,"fddddddddddddddddddddddddd")
|
||||
mnf_notification=False
|
||||
mnf_news=False
|
||||
if "Idea Mall" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Idea Mall",image_url = "/static/Notification_image/Idea_Mall.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Idea Mall",image_url = "/static/Notification_image/Idea_Mall.png")
|
||||
elif "Conversion - LPP" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Conversion - LPP",image_url = "/static/Notification_image/Conversion_LPP.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Conversion - LPP",image_url = "/static/Notification_image/Conversion_LPP.png")
|
||||
elif "Script Builder" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Script Builder",image_url = "/static/Notification_image/Script_Builder.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Script Builder",image_url = "/static/Notification_image/Script_Builder.png")
|
||||
elif "Messiah" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Messiah",image_url = "/static/Notification_image/Messiah.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Messiah",image_url = "/static/Notification_image/Messiah.png")
|
||||
elif "Project Centre" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Project Centre",image_url = "/static/Notification_image/Project_Centre.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Project Centre",image_url = "/static/Notification_image/Project_Centre.png")
|
||||
elif "Harkat" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Harkat",image_url = "/static/Notification_image/Harkat.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Harkat",image_url = "/static/Notification_image/Harkat.png")
|
||||
elif "Pitchdeck Bundle" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Pitchdeck Bundle",image_url = "/static/Notification_image/Pitchdeck_Bundle.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Pitchdeck Bundle",image_url = "/static/Notification_image/Pitchdeck_Bundle.png")
|
||||
elif "Script page" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Script Page",image_url = "/static/Notification_image/Script_page.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Script Page",image_url = "/static/Notification_image/Script_page.png")
|
||||
elif "subtitle" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Subtitle",image_url = "/static/Notification_image/subtitle.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Subtitle",image_url = "/static/Notification_image/subtitle.png")
|
||||
elif "script pad" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "script pad",image_url = "/static/Notification_image/subtitle.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "script pad",image_url = "/static/Notification_image/subtitle.png")
|
||||
elif "narration" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Narration",image_url = "/static/Notification_image/narration.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "narration",image_url = "/static/Notification_image/narration.png")
|
||||
elif "Institutional Membership" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Institutional Membership",image_url = "/static/Notification_image/Institutional_Membership.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Institutional Membership",image_url = "/static/Notification_image/Institutional_Membership.png")
|
||||
elif "LPP - Admininstration" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "LPP - Admininstration",image_url = "/static/Notification_image/LPP_Admininstration.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "LPP - Admininstration",image_url = "/static/Notification_image/LPP_Admininstration.png")
|
||||
elif "Conversion ppt" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Conversion PPT",image_url = "/static/Notification_image/Conversion_ppt.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Conversion PPT",image_url = "/static/Notification_image/Conversion_ppt.png")
|
||||
elif "viewers lounge" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Viewers Lounge",image_url = "/static/Notification_image/viewers_lounge.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Viewers Lounge",image_url = "/static/Notification_image/viewers_lounge.png")
|
||||
elif "Ask a question" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Ask a question",image_url = "/static/Notification_image/subtitle.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Ask a question",image_url = "/static/Notification_image/subtitle.png")
|
||||
elif "Payment" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Payment",image_url = "/static/Notification_image/payment.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Payment",image_url = "/static/Notification_image/payment.png")
|
||||
elif "blockchain" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "blockchain",image_url = "/static/Notification_image/blockchain.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "blockchain",image_url = "/static/Notification_image/blockchain.png")
|
||||
|
||||
elif "Sheet14" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Sheet14",image_url = "/static/Notification_image/subtitle.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Sheet14",image_url = "/static/Notification_image/subtitle.png")
|
||||
elif "Institutional Membership" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Institutional Membership",image_url = "/static/Notification_image/subtitle.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Institutional Membership",image_url = "/static/Notification_image/subtitle.png")
|
||||
elif "membershipReferences" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "membershipReferences",image_url = "/static/Notification_image/subtitle.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "membershipReferences",image_url = "/static/Notification_image/subtitle.png")
|
||||
elif "Juggernaut" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Juggernaut",image_url = "/static/Notification_image/Juggernaut.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Juggernaut",image_url = "/static/Notification_image/Juggernaut.png")
|
||||
elif "giftsubscription" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "giftsubscription",image_url = "/static/Notification_image/Juggernaut.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "giftsubscription",image_url = "/static/Notification_image/Juggernaut.png")
|
||||
elif "storytoscript" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "storytoscript",image_url = "/static/Notification_image/Juggernaut.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "storytoscript",image_url = "/static/Notification_image/Juggernaut.png")
|
||||
elif "Script Stall" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "Script Stall",image_url = "/static/Notification_image/Juggernaut.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "Script Stall",image_url = "/static/Notification_image/Juggernaut.png")
|
||||
elif "referfriend" in sheet_name:
|
||||
if notification_title:
|
||||
mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = "referfriend",image_url = "/static/Notification_image/Juggernaut.png")
|
||||
if news:
|
||||
mnf_news=Member_News(user=to_email,title=news,service_name = "referfriend",image_url = "/static/Notification_image/Juggernaut.png")
|
||||
|
||||
# else:
|
||||
# else:
|
||||
# mnf_notification=Mnf_Notification(user=to_email,title=notification_title,service_name = sheet_name)
|
||||
|
||||
|
||||
if mnf_notification:
|
||||
mnf_notification.save()
|
||||
print('notification sent')
|
||||
if mnf_news:
|
||||
mnf_news.save()
|
||||
print('news sent')
|
||||
|
||||
|
||||
|
||||
return
|
||||
except Exception as error:
|
||||
print(error)
|
||||
print(error,"-------------------------ERROR")
|
||||
import sys, os
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
||||
print(f"Exception type: {exc_type}, Function Name: {fname}, Line NO: {exc_tb.tb_lineno}")
|
||||
auto_email_function_errors.objects.create(email = to_email,email_code=email_code,key_value=key_value,error=str(error))
|
||||
pass
|
||||
|
||||
|
@ -249,9 +379,8 @@ def sendmail(to_email,email_code,key_value=None,filePath=None):
|
|||
def mnf_notification(request,pk=None):
|
||||
if request.method == "GET":
|
||||
if pk is not None:
|
||||
main = Mnf_Notification.objects.all().filter(user=pk)
|
||||
main = Mnf_Notification.objects.all().filter(user=pk).order_by('-created')
|
||||
if main:
|
||||
|
||||
serializer = Mnf_NotificationSerializer(main,many=True)
|
||||
return Response(serializer.data)
|
||||
else:
|
||||
|
@ -274,3 +403,32 @@ def mnf_notification(request,pk=None):
|
|||
# main = MemberProfile.objects.filter(projectid=pk)
|
||||
main.delete()
|
||||
return Response("data deleted")
|
||||
|
||||
@api_view(["GET"])
|
||||
@authentication_classes([JWTAuthentication])
|
||||
@permission_classes([IsAuthenticated])
|
||||
def getNews(request,pk=None):
|
||||
if request.method == "GET":
|
||||
if pk is not None:
|
||||
if centralDatabase.objects.filter(user_id=pk).exists():
|
||||
target_user = centralDatabase.objects.get(user_id=pk)
|
||||
main = Member_News.objects.all().filter(user=target_user.email).order_by('-created')
|
||||
if main:
|
||||
serializer = Member_NewsSerializer(main,many=True)
|
||||
return Response(serializer.data)
|
||||
else:
|
||||
return Response([])
|
||||
# if centralDatabase.objects.filter(user_id=pk).exists():
|
||||
# target_user = centralDatabase.objects.get(user_id=pk)
|
||||
# main = Member_News.objects.all().filter(user=target_user.email).order_by('-created')
|
||||
# if main:
|
||||
# serializer = Member_News(main,many=True,context={'replacement_name': target_user.firstName})
|
||||
# return Response(serializer.data)
|
||||
# else:
|
||||
# return Response([])
|
||||
# else:
|
||||
# return Response({"msg":"user not found"})
|
||||
|
||||
|
||||
|
||||
|
|
@ -314,7 +314,6 @@ def lpp_audit(msg):
|
|||
script_json["script_file_path"] = script_path1
|
||||
script_json["script_file"] = hash2
|
||||
script_json["type"] = "script-json"
|
||||
script_json["screenplay_name"] = str(name_script)
|
||||
scriptconversion["script-json"] = script_json
|
||||
print("blockchain script conversion 5.2")
|
||||
|
||||
|
@ -442,7 +441,7 @@ class Command(BaseCommand):
|
|||
sqs = session.resource('sqs', region_name='ap-south-1')
|
||||
|
||||
print("Started Executin this from conversion")
|
||||
queue = sqs.get_queue_by_name(QueueName="mnfqueue")
|
||||
queue = sqs.get_queue_by_name(QueueName="devqueue")
|
||||
# try:
|
||||
while True:
|
||||
|
||||
|
|
|
@ -610,7 +610,6 @@ class Conversion:
|
|||
script_json["script_file_path"] = script_path1
|
||||
script_json["script_file"] = hash2
|
||||
script_json["type"] = "script-json"
|
||||
script_json["screenplay_name"] = str(self.name_script)
|
||||
scriptconversion["script-json"] = script_json
|
||||
print("blockchain script conversion 5.2")
|
||||
|
||||
|
|
|
@ -45,15 +45,13 @@ def certificateGenrate(name,file_from,Hash,projectname="NAN",matic="0"):
|
|||
f'{basepath}/lpp/templates/lpp/blockchainCertificate.html')
|
||||
html = template.render(context)
|
||||
options = {
|
||||
'page-size': 'A4',
|
||||
'zoom': 12.5,
|
||||
'page-size': 'A5',
|
||||
'zoom': 3.5,
|
||||
'margin-top': '0.0in',
|
||||
'margin-right': '0.0in',
|
||||
'margin-bottom': '0.0in',
|
||||
'margin-left': '0.0in',
|
||||
'enable-local-file-access': '',
|
||||
'orientation': 'Landscape',
|
||||
'page-height': '11in',
|
||||
}
|
||||
pdfkit.from_string(
|
||||
html, f'{basepath}/lpp/certificate/certificate.pdf', options=options)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
dfdf
|
|
@ -338,7 +338,6 @@ def run_audit_in_counter(msg):
|
|||
script_json["script_file_path"] = script_path1
|
||||
script_json["script_file"] = hash2
|
||||
script_json["type"] = "script-json"
|
||||
script_json["screenplay_name"] = str(screenplay_name)
|
||||
audit_data["script-json"] = script_json
|
||||
print("data_uploaded")
|
||||
except Exception as exp:
|
||||
|
@ -489,7 +488,6 @@ def run_audit_in_counter(msg):
|
|||
script_json["script_file_path"] = script_path1
|
||||
script_json["script_file"] = hash2
|
||||
script_json["type"] = "script-json"
|
||||
script_json["screenplay_name"] = str(screenplay_name)
|
||||
audit_data["script-json"] = script_json
|
||||
print("data_uploaded")
|
||||
except Exception as exp:
|
||||
|
|
Loading…
Reference in New Issue