5474 lines
281 KiB
Python
Executable File
5474 lines
281 KiB
Python
Executable File
import math
|
||
from random import *
|
||
# from users.models import ReferUser
|
||
from django.shortcuts import redirect
|
||
# from django.shortcuts import render
|
||
# from pathlib import Path
|
||
from django.contrib.auth.models import User
|
||
# from django.core.files.storage import FileSystemStorage
|
||
import os
|
||
from decimal import Decimal
|
||
import simplejson as json
|
||
# from django.conf import settings
|
||
from django.shortcuts import render
|
||
# from .utils import render_to_pdf, convert_html_to_pdf
|
||
from django.http import HttpResponse, JsonResponse, HttpResponseBadRequest
|
||
# from subtitle.models import Subtitling
|
||
# from django.urls import reverse
|
||
# from django.utils.dateparse import parse_date
|
||
from django.contrib.auth.decorators import login_required
|
||
from django.core.mail import EmailMultiAlternatives
|
||
from django.utils.html import strip_tags
|
||
from datetime import datetime, timedelta
|
||
from datetime import date
|
||
# from django.contrib import messages
|
||
from django.template.loader import render_to_string
|
||
from django.template.loader import get_template
|
||
from .LPP.selected_or_not_selected import selected_or_not_selected
|
||
from .models import MNFLPPDDatabase, LPPTASKDatabase
|
||
# from subtitle.code.burn import hardburn, overlay
|
||
# from conversion.models import pptconversion
|
||
# from django.core.mail import EmailMessage
|
||
from django.conf import settings
|
||
# from users.models import ReferUser
|
||
import pandas as pd
|
||
from django.db.models import Q
|
||
# import threading
|
||
# from MNF.settings import BasePath, COUNTRY_KEY, EMAIL_HOST_USER
|
||
import subprocess
|
||
# from mnfapp.views import base
|
||
from users.models import UserCredentialsForBlockchain
|
||
from Blockchain2.decryption import decryptionOfPrivate, decryptionOfUrl, download_file_System
|
||
from Blockchain2.DataStorage import uploadDataToIPFSNode
|
||
from Blockchain2.PPTConversion import UploadPPTConversionData,getPPTConversion,getUserprojectIds,deletePPTConversion
|
||
from Blockchain2.blockchainsetting import OWNER_KEY
|
||
# from subtitling.views import lppupload
|
||
from MNF.settings import BasePath, MEDIA_ROOT
|
||
# from forex_python.converter import CurrencyRates
|
||
import stripe
|
||
# import razorpay
|
||
# import docx
|
||
# from docx.shared import Inches, Cm, Pt
|
||
import pdfkit
|
||
# from blockchain.submitIPFS import upload_to_ipfs, upload_multiFile_to_ipfs
|
||
import time
|
||
from users.models import *
|
||
from mnfapp.models import centralDatabase
|
||
# from users.models import Wallet
|
||
from django.core import serializers
|
||
from django.utils import timezone
|
||
import json
|
||
# from subtitling3.utils import completed
|
||
# from subtitling3.models import Videoes
|
||
# from subtitling3.code.burn import hardburn, overlay
|
||
# from Pitchdeck.views import multilingual_render
|
||
from auto_email.views import sendmail
|
||
from centralizePayment.views import auto_refund
|
||
# from relationshipmanager.models import RMDatabase
|
||
from conversion.translation.translation_variables import code_2_language
|
||
from django.contrib.sites.models import Site
|
||
# from xhtml2pdf import pisa
|
||
try:
|
||
domain = Site.objects.get_current().domain
|
||
except:
|
||
domain = ""
|
||
# domain = ""
|
||
|
||
# stripe.api_key = settings.STRIPE_SECRET_KEY
|
||
# STRIPE_PUB_KEY = settings.STRIPE_PUBLISHABLE_KEY
|
||
# keyID = settings.RAZORPAY_KEY_ID
|
||
# keySecret = settings.RAZORPAY_KEY_SECRET
|
||
UsdConversionRate = 80
|
||
basepath = BasePath()
|
||
country_list = {
|
||
"AD": "Andorra",
|
||
"AE": "United Arab Emirates",
|
||
"AF": "Afghanistan",
|
||
"AG": "Antigua & Barbuda",
|
||
"AI": "Anguilla",
|
||
"AL": "Albania",
|
||
"AM": "Armenia",
|
||
"AN": "Netherlands Antilles",
|
||
"AO": "Angola",
|
||
"AQ": "Antarctica",
|
||
"AR": "Argentina",
|
||
"AS": "American Samoa",
|
||
"AT": "Austria",
|
||
"AU": "Australia",
|
||
"AW": "Aruba",
|
||
"AZ": "Azerbaijan",
|
||
"BA": "Bosnia and Herzegovina",
|
||
"BB": "Barbados",
|
||
"BD": "Bangladesh",
|
||
"BE": "Belgium",
|
||
"BF": "Burkina Faso",
|
||
"BG": "Bulgaria",
|
||
"BH": "Bahrain",
|
||
"BI": "Burundi",
|
||
"BJ": "Benin",
|
||
"BM": "Bermuda",
|
||
"BN": "Brunei Darussalam",
|
||
"BO": "Bolivia",
|
||
"BR": "Brazil",
|
||
"BS": "Bahama",
|
||
"BT": "Bhutan",
|
||
"BU": "Burma (no longer exists)",
|
||
"BV": "Bouvet Island",
|
||
"BW": "Botswana",
|
||
"BY": "Belarus",
|
||
"BZ": "Belize",
|
||
"CA": "Canada",
|
||
"CC": "Cocos (Keeling) Islands",
|
||
"CF": "Central African Republic",
|
||
"CG": "Congo",
|
||
"CH": "Switzerland",
|
||
"CI": "Côte D'ivoire (Ivory Coast)",
|
||
"CK": "Cook Iislands",
|
||
"CL": "Chile",
|
||
"CM": "Cameroon",
|
||
"CN": "China",
|
||
"CO": "Colombia",
|
||
"CR": "Costa Rica",
|
||
"CS": "Czechoslovakia (no longer exists)",
|
||
"CU": "Cuba",
|
||
"CV": "Cape Verde",
|
||
"CX": "Christmas Island",
|
||
"CY": "Cyprus",
|
||
"CZ": "Czech Republic",
|
||
"DD": "German Democratic Republic (no longer exists)",
|
||
"DE": "Germany",
|
||
"DJ": "Djibouti",
|
||
"DK": "Denmark",
|
||
"DM": "Dominica",
|
||
"DO": "Dominican Republic",
|
||
"DZ": "Algeria",
|
||
"EC": "Ecuador",
|
||
"EE": "Estonia",
|
||
"EG": "Egypt",
|
||
"EH": "Western Sahara",
|
||
"ER": "Eritrea",
|
||
"ES": "Spain",
|
||
"ET": "Ethiopia",
|
||
"FI": "Finland",
|
||
"FJ": "Fiji",
|
||
"FK": "Falkland Islands (Malvinas)",
|
||
"FM": "Micronesia",
|
||
"FO": "Faroe Islands",
|
||
"FR": "France",
|
||
"FX": "France, Metropolitan",
|
||
"GA": "Gabon",
|
||
"GB": "United Kingdom (Great Britain)",
|
||
"GD": "Grenada",
|
||
"GE": "Georgia",
|
||
"GF": "French Guiana",
|
||
"GH": "Ghana",
|
||
"GI": "Gibraltar",
|
||
"GL": "Greenland",
|
||
"GM": "Gambia",
|
||
"GN": "Guinea",
|
||
"GP": "Guadeloupe",
|
||
"GQ": "Equatorial Guinea",
|
||
"GR": "Greece",
|
||
"GS": "South Georgia and the South Sandwich Islands",
|
||
"GT": "Guatemala",
|
||
"GU": "Guam",
|
||
"GW": "Guinea-Bissau",
|
||
"GY": "Guyana",
|
||
"HK": "Hong Kong",
|
||
"HM": "Heard & McDonald Islands",
|
||
"HN": "Honduras",
|
||
"HR": "Croatia",
|
||
"HT": "Haiti",
|
||
"HU": "Hungary",
|
||
"ID": "Indonesia",
|
||
"IE": "Ireland",
|
||
"IL": "Israel",
|
||
"IN": "India",
|
||
"IO": "British Indian Ocean Territory",
|
||
"IQ": "Iraq",
|
||
"IR": "Islamic Republic of Iran",
|
||
"IS": "Iceland",
|
||
"IT": "Italy",
|
||
"JM": "Jamaica",
|
||
"JO": "Jordan",
|
||
"JP": "Japan",
|
||
"KE": "Kenya",
|
||
"KG": "Kyrgyzstan",
|
||
"KH": "Cambodia",
|
||
"KI": "Kiribati",
|
||
"KM": "Comoros",
|
||
"KN": "St. Kitts and Nevis",
|
||
"KP": "Korea, Democratic People's Republic of",
|
||
"KR": "Korea, Republic of",
|
||
"KW": "Kuwait",
|
||
"KY": "Cayman Islands",
|
||
"KZ": "Kazakhstan",
|
||
"LA": "Lao People's Democratic Republic",
|
||
"LB": "Lebanon",
|
||
"LC": "Saint Lucia",
|
||
"LI": "Liechtenstein",
|
||
"LK": "Sri Lanka",
|
||
"LR": "Liberia",
|
||
"LS": "Lesotho",
|
||
"LT": "Lithuania",
|
||
"LU": "Luxembourg",
|
||
"LV": "Latvia",
|
||
"LY": "Libyan Arab Jamahiriya",
|
||
"MA": "Morocco",
|
||
"MC": "Monaco",
|
||
"MD": "Moldova, Republic of",
|
||
"MG": "Madagascar",
|
||
"MH": "Marshall Islands",
|
||
"ML": "Mali",
|
||
"MN": "Mongolia",
|
||
"MM": "Myanmar",
|
||
"MO": "Macau",
|
||
"MP": "Northern Mariana Islands",
|
||
"MQ": "Martinique",
|
||
"MR": "Mauritania",
|
||
"MS": "Monserrat",
|
||
"MT": "Malta",
|
||
"MU": "Mauritius",
|
||
"MV": "Maldives",
|
||
"MW": "Malawi",
|
||
"MX": "Mexico",
|
||
"MY": "Malaysia",
|
||
"MZ": "Mozambique",
|
||
"NA": "Namibia",
|
||
"NC": "New Caledonia",
|
||
"NE": "Niger",
|
||
"NF": "Norfolk Island",
|
||
"NG": "Nigeria",
|
||
"NI": "Nicaragua",
|
||
"NL": "Netherlands",
|
||
"NO": "Norway",
|
||
"NP": "Nepal",
|
||
"NR": "Nauru",
|
||
"NT": "Neutral Zone (no longer exists)",
|
||
"NU": "Niue",
|
||
"NZ": "New Zealand",
|
||
"OM": "Oman",
|
||
"PA": "Panama",
|
||
"PE": "Peru",
|
||
"PF": "French Polynesia",
|
||
"PG": "Papua New Guinea",
|
||
"PH": "Philippines",
|
||
"PK": "Pakistan",
|
||
"PL": "Poland",
|
||
"PM": "St. Pierre & Miquelon",
|
||
"PN": "Pitcairn",
|
||
"PR": "Puerto Rico",
|
||
"PT": "Portugal",
|
||
"PW": "Palau",
|
||
"PY": "Paraguay",
|
||
"QA": "Qatar",
|
||
"RE": "Réunion",
|
||
"RO": "Romania",
|
||
"RU": "Russian Federation",
|
||
"RW": "Rwanda",
|
||
"SA": "Saudi Arabia",
|
||
"SB": "Solomon Islands",
|
||
"SC": "Seychelles",
|
||
"SD": "Sudan",
|
||
"SE": "Sweden",
|
||
"SG": "Singapore",
|
||
"SH": "St. Helena",
|
||
"SI": "Slovenia",
|
||
"SJ": "Svalbard & Jan Mayen Islands",
|
||
"SK": "Slovakia",
|
||
"SL": "Sierra Leone",
|
||
"SM": "San Marino",
|
||
"SN": "Senegal",
|
||
"SO": "Somalia",
|
||
"SR": "Suriname",
|
||
"ST": "Sao Tome & Principe",
|
||
"SU": "Union of Soviet Socialist Republics (no longer exists)",
|
||
"SV": "El Salvador",
|
||
"SY": "Syrian Arab Republic",
|
||
"SZ": "Swaziland",
|
||
"TC": "Turks & Caicos Islands",
|
||
"TD": "Chad",
|
||
"TF": "French Southern Territories",
|
||
"TG": "Togo",
|
||
"TH": "Thailand",
|
||
"TJ": "Tajikistan",
|
||
"TK": "Tokelau",
|
||
"TM": "Turkmenistan",
|
||
"TN": "Tunisia",
|
||
"TO": "Tonga",
|
||
"TP": "East Timor",
|
||
"TR": "Turkey",
|
||
"TT": "Trinidad & Tobago",
|
||
"TV": "Tuvalu",
|
||
"TW": "Taiwan, Province of China",
|
||
"TZ": "Tanzania, United Republic of",
|
||
"UA": "Ukraine",
|
||
"UG": "Uganda",
|
||
"UM": "United States Minor Outlying Islands",
|
||
"US": "United States of America",
|
||
"UY": "Uruguay",
|
||
"UZ": "Uzbekistan",
|
||
"VA": "Vatican City State (Holy See)",
|
||
"VC": "St. Vincent & the Grenadines",
|
||
"VE": "Venezuela",
|
||
"VG": "British Virgin Islands",
|
||
"VI": "United States Virgin Islands",
|
||
"VN": "Viet Nam",
|
||
"VU": "Vanuatu",
|
||
"WF": "Wallis & Futuna Islands",
|
||
"WS": "Samoa",
|
||
"YD": "Democratic Yemen (no longer exists)",
|
||
"YE": "Yemen",
|
||
"YT": "Mayotte",
|
||
"YU": "Yugoslavia",
|
||
"ZA": "South Africa",
|
||
"ZM": "Zambia",
|
||
"ZR": "Zaire",
|
||
"ZW": "Zimbabwe",
|
||
"ZZ": "Unknown or unspecified country",
|
||
}
|
||
languages = code_2_language
|
||
|
||
COUNTRY_KEY = "00000000000000000000000000000000"
|
||
|
||
def time_in_hmsms_format(seconds):
|
||
milliseconds = int((seconds - int(seconds)) * 1000)
|
||
seconds = int(seconds)
|
||
minutes, seconds = divmod(seconds, 60)
|
||
hours, minutes = divmod(minutes, 60)
|
||
return f'{hours:02d}:{minutes:02d}:{seconds:02d},{milliseconds:03d}'
|
||
|
||
|
||
|
||
|
||
def check_promotion(y):
|
||
if y.no_task_completed > 49 or y.no_task_completed > 200:
|
||
if y.level == "Beginner":
|
||
y.level = "Proficient"
|
||
elif y.level == "Proficient":
|
||
y.level = "Expert"
|
||
elif y.level == "Expert":
|
||
y.level = "Expert"
|
||
else:
|
||
pass
|
||
y.save()
|
||
|
||
|
||
|
||
with open(f"{basepath}/MNF/json_keys/conversionRates.json") as c:
|
||
curr = json.load(c)
|
||
try:
|
||
usd_inr_rate = curr["rates"]["INR"]
|
||
# c = CurrencyRates()
|
||
# rate = c.get_rate("USD", str(currency.upper()))
|
||
except Exception as e:
|
||
print("checkout error", e)
|
||
usd_inr_rate = 80
|
||
|
||
|
||
def convert_to_pdf(input_docx, out_folder):
|
||
'''DOCX TO PDF'''
|
||
p = subprocess.Popen(
|
||
[
|
||
"libreoffice",
|
||
"--headless",
|
||
"--convert-to",
|
||
"pdf",
|
||
"--outdir",
|
||
out_folder,
|
||
input_docx,
|
||
]
|
||
)
|
||
print(["--convert-to", "pdf", input_docx])
|
||
|
||
p.communicate()
|
||
print("DOCX TO PDF DONE")
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def MNFLPP(request):
|
||
if request.user.is_authenticated:
|
||
if MNFLPPDDatabase.objects.filter(user_id=request.user).exists():
|
||
return render(request, "lpp/alreadyRegister.html", {})
|
||
# return multilingual_render(request, "lpp/alreadyRegister.html", {})
|
||
|
||
if request.method == "POST":
|
||
start_time = time.time()
|
||
x = MNFLPPDDatabase()
|
||
x.user_id = request.user
|
||
|
||
|
||
if not os.path.exists(f'{basepath}/media/lpp_documents'):
|
||
os.makedirs(f'{basepath}/media/lpp_documents', mode=0o777)
|
||
|
||
|
||
# personal-info
|
||
x.first_name = request.POST.get("firstName")
|
||
x.last_name = request.POST.get("lastName")
|
||
x.lpp_email = request.POST.get("emailId")
|
||
x.countryCode = request.POST.get("code")
|
||
x.contact = request.POST.get("number")
|
||
x.country = country_list[str(request.POST.get("country")).upper()]
|
||
x.province = request.POST.get("state")
|
||
if request.POST.get("city") == "" or request.POST.get("city") == None:
|
||
x.city = "N/A"
|
||
else:
|
||
x.city = request.POST.get("city")
|
||
if request.POST.get("motherTongue") != "Others":
|
||
x.motherTongue = request.POST.get("motherTongue")
|
||
else:
|
||
if request.POST.get("othermothertongue") == "" or request.POST.get("othermothertongue") == None:
|
||
x.motherTongue = "Others"
|
||
else:
|
||
x.motherTongue = request.POST.get("othermothertongue")
|
||
if request.POST.get("fathersMotherToungue") == "":
|
||
x.fathersMotherTongue = "N/A"
|
||
else:
|
||
if request.POST.get("fathersMotherToungue") != "Others":
|
||
x.fathersMotherTongue = request.POST.get(
|
||
"fathersMotherToungue")
|
||
else:
|
||
if request.POST.get("otherfathertongue") == "" or request.POST.get("otherfathertongue") == None:
|
||
x.fathersMotherTongue = "Others"
|
||
else:
|
||
x.fathersMotherTongue = request.POST.get(
|
||
"otherfathertongue")
|
||
if request.POST.get("mothersMotherToungue") == "mother'sMotherToungue":
|
||
x.mothersMotherTongue = "N/A"
|
||
else:
|
||
if request.POST.get("mothersMotherToungue") != "Others":
|
||
x.mothersMotherTongue = request.POST.get(
|
||
"mothersMotherToungue")
|
||
else:
|
||
if request.POST.get("othertongue") == "" or request.POST.get("othertongue") == None:
|
||
x.mothersMotherTongue = "Others"
|
||
else:
|
||
x.mothersMotherTongue = request.POST.get("othertongue")
|
||
|
||
# I offer myself
|
||
x.firstLanguage = request.POST.get("firstLanguage")
|
||
if request.POST.get("motherTounge") == "on":
|
||
x.choice11 = True
|
||
if request.POST.get("nativLanguage") == "on":
|
||
x.choice12 = True
|
||
if request.POST.get("mediumOfInstruction") == "on":
|
||
x.choice13 = True
|
||
if request.POST.get("mediumOfInstructionL1") == "throughout":
|
||
x.firstLangMedium = "throughout"
|
||
else:
|
||
x.firstLangMedium = request.POST.get(
|
||
"mediumOfInstructionL1")
|
||
else:
|
||
x.firstLangMedium = "N/A"
|
||
# if request.POST.get('mediumOfInstruction'):
|
||
if request.POST.get("qualifiedInParticularLanguage") == "on":
|
||
x.choice14 = True
|
||
x.firstlangDialect = request.POST.getlist("dialect1[]")
|
||
if request.POST.get("accent1") == "" or request.POST.get("accent1") == None:
|
||
x.firstlangaccent = "N/A"
|
||
else:
|
||
x.firstlangaccent = request.POST.get("accent1")
|
||
if request.POST.get("accent2") == "" or request.POST.get("accent2") == None:
|
||
x.secondlangaccent = "N/A"
|
||
else:
|
||
x.secondlangaccent = request.POST.get("accent2")
|
||
x.secondLanguage = request.POST.get("secondLanguage")
|
||
if request.POST.get("motherTounge1") == "on":
|
||
x.choice21 = True
|
||
if request.POST.get("nativLanguage1") == "on":
|
||
x.choice22 = True
|
||
if request.POST.get("mediumOfInstruction1") == "on":
|
||
x.choice23 = True
|
||
if request.POST.get("mediumOfInstructionL2") == "throughout":
|
||
x.secondLangMedium = "throughout"
|
||
else:
|
||
x.secondLangMedium = request.POST.get(
|
||
"mediumOfInstructionL2")
|
||
else:
|
||
x.secondLangMedium = "N/A"
|
||
if request.POST.get("qualifiedInParticularLanguage1") == "on":
|
||
x.choice24 = True
|
||
x.secondlangDialect = request.POST.getlist("dialect2[]")
|
||
|
||
unique_scripts = ['Devanagari', 'Arabic', 'Malayalam', 'Telugu', 'Bengali', 'Kannada', 'Hanji', 'Gurmukhi', 'Gujarati',
|
||
'Oriya', 'Kana', 'Javanese', 'Hangul', 'Burmese', 'Thai', 'Sundanese', 'Lao', 'Amharic', 'Sinhala',
|
||
'Hebrew', 'Cyrillic', 'Armanian', 'Khmer', 'Georgian', 'Mongolian', 'Tamil', 'Latin']
|
||
scripts = []
|
||
for key, value in request.POST.items():
|
||
if key in unique_scripts:
|
||
scripts.append(key)
|
||
save_data = ",".join(scripts)
|
||
print("All SCripts are ->", save_data)
|
||
# print("req post 1412",request.POST.getlist("user_scripts"))
|
||
# print("req post 1413",request.POST.getlist("user_scripts[]"))
|
||
x.scripts = save_data
|
||
|
||
# My relevent qualifications
|
||
if request.POST.get("firstLangDegree") == "Others":
|
||
x.firstLangDegree = request.POST.get("degreeAward")
|
||
elif request.POST.get("firstLangDegree") == "" or request.POST.get("firstLangDegree") == None or request.POST.get("firstLangDegree") == "None":
|
||
x.firstLangDegree = "Empty"
|
||
else:
|
||
x.firstLangDegree = request.POST.get("firstLangDegree")
|
||
|
||
x.firstLangAwardedBy = request.POST.get("firstLangAwardedBy")
|
||
x.firstLangDegreeFile = request.FILES.get("firstLangDegreeFile")
|
||
if request.POST.get("secondLangDegree") == "Others":
|
||
x.secondLangDegree = request.POST.get("awarded")
|
||
elif request.POST.get("secondLangDegree") == "" or request.POST.get("secondLangDegree") == None or request.POST.get("secondLangDegree") == "None":
|
||
x.secondLangDegree = "Empty"
|
||
else:
|
||
x.secondLangDegree = request.POST.get("secondLangDegree")
|
||
x.secondLangAwardedBy = request.POST.get("secondLangAwardedBy")
|
||
x.secondLangDegreeFile = request.FILES.get("secondLangDegreeFile")
|
||
|
||
# Professional certification for translation between L1 & L2
|
||
if request.POST.get("certificationL1L2") == "Others":
|
||
if request.POST.get("certificationL1L22") == "" or request.POST.get("certificationL1L22") == None:
|
||
x.certificationL1L2 = "Others"
|
||
else:
|
||
x.certificationL1L2 = request.POST.get(
|
||
"certificationL1L22")
|
||
elif request.POST.get("certificationL1L2") == "nameOfDegree":
|
||
x.certificationL1L2 = "N/A"
|
||
else:
|
||
x.certificationL1L2 = request.POST.get("certificationL1L2")
|
||
if request.POST.get("certttificationAwardedByL1L2") == "" or request.POST.get("certttificationAwardedByL1L2") == None:
|
||
x.certttificationAwardedByL1L2 = "N/A"
|
||
else:
|
||
x.certttificationAwardedByL1L2 = request.POST.get(
|
||
"certttificationAwardedByL1L2"
|
||
)
|
||
if request.POST.get("durationCertificationL1L2") == None or request.POST.get("durationCertificationL1L2") == "" or request.POST.get("durationCertificationL1L2") == "nameOfDegree":
|
||
x.durationCertificationL1L2 = "N/A"
|
||
else:
|
||
x.durationCertificationL1L2 = request.POST.get(
|
||
"durationCertificationL1L2")
|
||
if request.POST.get("modeCertificationL1L2") == None or request.POST.get("modeCertificationL1L2") == "":
|
||
x.modeCertificationL1L2 = "N/A"
|
||
else:
|
||
x.modeCertificationL1L2 = request.POST.get(
|
||
"modeCertificationL1L2")
|
||
try:
|
||
x.certificationFile = request.FILES["certificationFile"]
|
||
except:
|
||
pass
|
||
|
||
# Relevant professional experience
|
||
if request.POST.get("expFirstLang") == "" or request.POST.get("expFirstLang") == None or request.POST.get("expFirstLang") == "N/A":
|
||
x.expFirstLang = "N/A"
|
||
else:
|
||
x.expFirstLang = request.POST.get("expFirstLang")
|
||
if request.POST.get("expSecondLang") == "" or request.POST.get("expSecondLang") == None or request.POST.get("expSecondLang") == "N/A":
|
||
x.expSecondLang = "N/A"
|
||
else:
|
||
x.expSecondLang = request.POST.get("expSecondLang")
|
||
if request.POST.get("scriptWrittenFirstLang") == "" or request.POST.get("scriptWrittenFirstLang") == None or request.POST.get("scriptWrittenFirstLang") == "N/A":
|
||
x.scriptWrittenFirstLang = "N/A"
|
||
else:
|
||
x.scriptWrittenFirstLang = request.POST.get(
|
||
"scriptWrittenFirstLang")
|
||
x.scriptWrittenFirstLangLink = request.POST.get(
|
||
"scriptWrittenFirstLangLink")
|
||
|
||
if request.POST.get("scriptWrittenSecondLang") == "" or request.POST.get("scriptWrittenSecondLang") == None or request.POST.get("scriptWrittenSecondLang") == "N/A":
|
||
x.scriptWrittenSecondLang = "N/A"
|
||
else:
|
||
x.scriptWrittenSecondLang = request.POST.get(
|
||
"scriptWrittenSecondLang")
|
||
x.scriptWrittenSecondLangLink = request.POST.get(
|
||
"scriptWrittenSecondLangLink"
|
||
)
|
||
if request.POST.get("noScriptTransFromL1toL2") == "" or request.POST.get("noScriptTransFromL1toL2") == None or request.POST.get("noScriptTransFromL1toL2") == "N/A":
|
||
x.noScriptTransFromL1toL2 = "N/A"
|
||
else:
|
||
x.noScriptTransFromL1toL2 = request.POST.get(
|
||
"noScriptTransFromL1toL2")
|
||
x.noScriptTransFromL1toL2Link = request.POST.get(
|
||
"noScriptTransFromL1toL2Link"
|
||
)
|
||
if request.POST.get("noScriptTransFromL2toL1") == "" or request.POST.get("noScriptTransFromL2toL1") == None or request.POST.get("noScriptTransFromL2toL1") == "N/A":
|
||
x.noScriptTransFromL2toL1 = "N/A"
|
||
else:
|
||
x.noScriptTransFromL2toL1 = request.POST.get(
|
||
"noScriptTransFromL2toL1")
|
||
x.noScriptTransFromL2toL1Link = request.POST.get(
|
||
"noScriptTransFromL2toL1Link"
|
||
)
|
||
if request.POST.get("noArticleTransFromL1toL2") == "" or request.POST.get("noArticleTransFromL1toL2") == None or request.POST.get("noArticleTransFromL1toL2") == "N/A":
|
||
x.noArticleTransFromL1toL2 = "N/A"
|
||
else:
|
||
x.noArticleTransFromL1toL2 = request.POST.get(
|
||
"noArticleTransFromL1toL2")
|
||
x.noArticleTransFromL1toL2Link = request.POST.get(
|
||
"noArticleTransFromL1toL2Link"
|
||
)
|
||
if request.POST.get("noArticleTransFromL2toL1") == "" or request.POST.get("noArticleTransFromL2toL1") == None or request.POST.get("noArticleTransFromL2toL1") == "N/A":
|
||
x.noArticleTransFromL2toL1 = "N/A"
|
||
else:
|
||
x.noArticleTransFromL2toL1 = request.POST.get(
|
||
"noArticleTransFromL2toL1")
|
||
x.noArticleTransFromL2toL1Link = request.POST.get(
|
||
"noArticleTransFromL2toL1Link"
|
||
)
|
||
|
||
result, score = selected_or_not_selected(
|
||
# personal-info
|
||
x.province, # not used
|
||
x.motherTongue,
|
||
x.fathersMotherTongue,
|
||
x.mothersMotherTongue,
|
||
# I offer myself
|
||
x.firstLanguage,
|
||
x.choice11,
|
||
x.choice12,
|
||
x.choice13,
|
||
x.firstLangMedium,
|
||
x.choice14,
|
||
# x.firstlangDialect,
|
||
x.secondLanguage,
|
||
x.choice21,
|
||
x.choice22,
|
||
x.choice23,
|
||
x.secondLangMedium,
|
||
x.choice24,
|
||
# x.secondlangDialect,
|
||
# My relevent qualifications
|
||
x.firstLangDegree,
|
||
x.firstLangDegreeFile,
|
||
x.secondLangDegree,
|
||
x.secondLangDegreeFile,
|
||
# Professional certification for translation between L1 & L2
|
||
x.certificationL1L2,
|
||
x.durationCertificationL1L2,
|
||
x.certificationFile,
|
||
# Relevant professional experience
|
||
x.expFirstLang,
|
||
x.scriptWrittenFirstLang,
|
||
x.noScriptTransFromL1toL2,
|
||
x.noArticleTransFromL1toL2,
|
||
x.expSecondLang,
|
||
x.scriptWrittenSecondLang,
|
||
x.noScriptTransFromL2toL1,
|
||
x.noArticleTransFromL2toL1,
|
||
)
|
||
x.score = score
|
||
if result == "Selected":
|
||
x.status = "Shortlisted by Algo"
|
||
else:
|
||
# manoj - store data in central database
|
||
cd = centralDatabase.objects.get(user_id=request.user)
|
||
cd.firstName = x.first_name
|
||
cd.lastName = x.last_name
|
||
cd.email = x.lpp_email
|
||
cd.countryCode = x.countryCode
|
||
cd.contact = x.contact
|
||
cd.country = x.country
|
||
cd.state = x.province
|
||
cd.city = x.city
|
||
cd.language = x.motherTongue
|
||
cd.lpp = True
|
||
cd.save()
|
||
return render(request, "lpp/rejectlpp.html")
|
||
# return multilingual_render(request, "lpp/rejectlpp.html", {})
|
||
|
||
|
||
# if (
|
||
# MNFLPPDDatabase.objects.filter(firstLanguage=x.firstLanguage)
|
||
# .filter(secondLanguage=x.secondLanguage)
|
||
# .exists()
|
||
# ):
|
||
# var1 = MNFLPPDDatabase.objects.filter(
|
||
# firstLanguage=x.firstLanguage
|
||
# ).filter(secondLanguage=x.secondLanguage)
|
||
# l1 = []
|
||
# for i in var1:
|
||
# l1.append(i.score)
|
||
|
||
# minVal = min(l1)
|
||
|
||
# if x.score <= minVal:
|
||
# x.status = "Rejected"
|
||
# else:
|
||
# x.status = "Shortlisted by Algo"
|
||
# else:
|
||
# x.status = "Shortlisted by Algo"
|
||
|
||
x.save()
|
||
|
||
# manoj - store data in central database
|
||
cd = centralDatabase.objects.get(user_id=request.user)
|
||
cd.firstName = x.first_name
|
||
cd.lastName = x.last_name
|
||
cd.email = x.lpp_email
|
||
cd.countryCode = x.countryCode
|
||
cd.contact = x.contact
|
||
cd.country = x.country
|
||
cd.state = x.province
|
||
cd.city = x.city
|
||
cd.language = x.motherTongue
|
||
cd.save()
|
||
|
||
# template = get_template("lpp/nda.html")
|
||
# context = {
|
||
# "source_lang": x.firstLanguage,
|
||
# "target_lang": x.secondLanguage,
|
||
# "name": x.first_name,
|
||
# "status": "Shortlisted by Algo",
|
||
# "user": request.user,
|
||
# }
|
||
# html = template.render(context)
|
||
# pdf = render_to_pdf("lpp/nda.html", context)
|
||
# # response = HttpResponse(pdf, content_type="application/pdf")
|
||
# # Send Email
|
||
#
|
||
# subject = "Congratulations your application is considered for review!"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
# to = x.lpp_email
|
||
# context = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP1",
|
||
# "heading1": " Kindly Upload signed NDA ",
|
||
# "heading2": " Attached with this Email ",
|
||
# }
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/lpp/templates/lpp/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.attach_file(
|
||
# rf"/{basepath}/media/PdfFiles/MNF-NDA.pdf")
|
||
# msg.send()
|
||
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": request.user.username
|
||
}
|
||
sendmail(to_email=[to], email_code="ID2", key_value=key_value,
|
||
filePath=rf"/{basepath}/media/PdfFiles/MNF-NDA.pdf")
|
||
|
||
|
||
# -> Code to alert User about certificates he filled info for but didn't uploaded
|
||
certificates = {"firstLangDegree":[x.firstLangDegree,x.firstLangDegreeFile, rf"{x.firstLangDegree} for Highest Qualification of {x.firstLanguage} Language" ],
|
||
"secondLangDegree":[x.secondLangDegree , x.secondLangDegreeFile,rf"{x.secondLangDegree} for Highest Qualification of {x.secondLanguage} Language" ],
|
||
"LanguageTranslationCertificate":[x.certificationL1L2, x.certificationFile,rf"{x.certificationL1L2} for Professional certification of {x.firstLanguage} and {x.secondLanguage} Language" ]}
|
||
files_to_be_requested = []
|
||
|
||
for key in certificates.keys():
|
||
if certificates[key][0] != "N/A" and certificates[key][0] != "" and certificates[key][0] != "Empty" and certificates[key][0] != None and certificates[key][0] != "None":
|
||
if str((certificates[key][1]).name) == "" or str((certificates[key][1]).name) == "N/A" or str((certificates[key][1]).name) == None or str((certificates[key][1]).name) == "None":
|
||
files_to_be_requested.append(certificates[key][2])
|
||
|
||
|
||
# ALert to LPP about his registration
|
||
if len(files_to_be_requested) != 0:
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username,
|
||
"certificate name": str("\t".join(files_to_be_requested)),
|
||
"link": rf"https://mynextfilm.ai/lpp/majortable/{x.lpp_id}/view"
|
||
}
|
||
sendmail(to_email=[to], email_code="ID23", key_value=key_value)
|
||
|
||
|
||
# Alert to Admin for new registration
|
||
to = settings.EMAIL_HOST_USER
|
||
key_value = {
|
||
"User": "Admin",
|
||
"score": x.score
|
||
}
|
||
sendmail(to_email=[to], email_code="ID3", key_value=key_value)
|
||
|
||
|
||
# context = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP1",
|
||
# "heading1": " Kindly Upload these Files using LPP Details LHm Option",
|
||
# "heading2": str("\t".join(files_to_be_requested)),
|
||
# }
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/lpp/templates/lpp/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# subject = "kindly upload these files"
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, settings.EMAIL_HOST_USER, [x.lpp_email])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
end_time = time.time()
|
||
print("time taken lpp registration->",end_time-start_time)
|
||
|
||
return render(request, "lpp/thankslpp.html")
|
||
# return multilingual_render(request, "lpp/thankslpp.html", {})
|
||
|
||
else:
|
||
context = {"key": COUNTRY_KEY,
|
||
'cd': centralDatabase.objects.get(user_id=request.user)}
|
||
return render(request, "lpp/lppreg.html", context)
|
||
# return multilingual_render(request, "lpp/lppreg.html", context)
|
||
else:
|
||
context = {"key": COUNTRY_KEY,
|
||
'cd': centralDatabase.objects.get(user_id=request.user)}
|
||
return render(request, "lpp/lppreg.html", context)
|
||
# return multilingual_render(request, "lpp/lppreg.html", context)
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def lppdelete(request, id):
|
||
lpp = MNFLPPDDatabase.objects.get(lpp_id=id)
|
||
to = lpp.lpp_email
|
||
key_value = {
|
||
"User": lpp.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="ID19", key_value=key_value)
|
||
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=id).delete()
|
||
return redirect("/lpp/adminpanel/")
|
||
|
||
|
||
def datascriptslpp(request):
|
||
|
||
df = pd.read_csv(rf"{basepath}/lpp/scripts.csv", encoding='ISO-8859-1')
|
||
|
||
lang1 = request.POST.get("firstlang")
|
||
lang2 = request.POST.get("secondlang")
|
||
|
||
list1_d = df.loc[df[lang1] == "D", "Script"].tolist()
|
||
list1_y = df.loc[df[lang1] == "Y", "Script"].tolist()
|
||
list1_dy = list1_d + list1_y
|
||
|
||
list2_d = df.loc[df[lang2] == "D", "Script"].tolist()
|
||
list2_y = df.loc[df[lang2] == "Y", "Script"].tolist()
|
||
list2_dy = list2_d + list2_y
|
||
|
||
final_list = list(set(list1_dy + list2_dy))
|
||
|
||
return JsonResponse({"data": final_list})
|
||
|
||
|
||
def datadilectlpp(request):
|
||
# df = pd.read_csv(rf"{basepath}/lpp/scripts.csv")
|
||
lang = request.POST.get("lang")
|
||
dialects = {
|
||
'Afrikaans': ['Cape Afrikaans', 'Orange River Afrikaans', 'Eastern Border Afrikaans', 'Namibian Afrikaans'],
|
||
'Albanian': ['Gheg Albanian', 'Tosk Albanian', 'Arbëresh'],
|
||
'Amharic': ['Standard Amharic', 'Shewa Amharic', 'Gojjam Amharic', 'Gondar Amharic', 'Wollo Amharic',
|
||
'Tigray Amharic'],
|
||
'Arabic': ['Egyptian Arabic', 'Levantine Arabic', 'Gulf Arabic', 'Moroccan Arabic', 'Algerian Arabic',
|
||
'Tunisian Arabic', 'Sudanese Arabic', 'Yemeni Arabic'],
|
||
'Armenian': ['Eastern Armenian', 'Western Armenian', 'Grabar', 'Karabakh Armenian', 'Cilician Armenian'],
|
||
'Azerbaijani ': ['North Azerbaijani', 'South Azerbaijani', 'Northwestern Azerbaijani',
|
||
'Southwestern Azerbaijani', 'Eastern Azerbaijani', 'Western Azerbaijani'],
|
||
'Basque': ['Bizkaian', 'Gipuzkoan', 'High Navarrese', 'Low Navarrese', 'Lapurdian', 'Zuberoan'],
|
||
'Belarusian': ['Central Belarusian', 'Northwest Belarusian', 'South Belarusian', 'West Palesian'],
|
||
'Bengali': ['Standard Bengali', 'Chittagonian', 'Dhakaiya Bengali', 'Sylheti', 'Rajbanshi'],
|
||
'Bosnian': ['Shtokavian dialect (Ikavian)', 'Shtokavian dialect (Ijekavian)', 'Shtokavian dialect (Ekavian)',
|
||
'Chakavian dialect', 'Kajkavian dialect'],
|
||
'Bulgarian': ['Western Bulgarian', 'Northern Bulgarian', 'Eastern Bulgarian', 'Rup dialect', 'Rhodope dialect',
|
||
'Pirin dialect', 'Macedonian dialect', 'Banat Bulgarian'],
|
||
'Catalan': ['Central Catalan', 'Northern Catalan', 'Western Catalan', 'Balearic Catalan', 'Valencian Catalan',
|
||
'Alguerese Catalan'],
|
||
'Cebuano': ['Standard Cebuano', 'Cebu City Cebuano', 'Boholano Cebuano', 'Mindanao Cebuano', 'Leyte Cebuano',
|
||
'Surigaonon', 'Agusanon', 'Camotes Cebuano'],
|
||
'Chinese-Simplified': ['Mandarin', 'Cantonese', 'Shanghainese', 'Hokkien (Min Nan)', 'Hakka',
|
||
'Wu (Shanghainese)', 'Yue (Cantonese)', 'Gan', 'Pinghua'],
|
||
'Chinese-Traditional': ['Mandarin', 'Cantonese', 'Shanghainese', 'Hokkien (Min Nan)', 'Hakka',
|
||
'Wu (Shanghainese)', 'Yue (Cantonese)', 'Gan', 'Pinghua'],
|
||
'Corsican': ['Northern Corsican', 'Southern Corsican', 'Sartenais', 'Gallurese Corsican',
|
||
'Bonifacian Corsican'],
|
||
'Croatian': ['Kajkavian dialect', 'Chakavian dialect', 'Shtokavian dialect (Ikavian)',
|
||
'Shtokavian dialect (Ijekavian)', 'Shtokavian dialect (Ekavian)', 'Burgenland Croatian',
|
||
'Molise Croatian'],
|
||
'Czech': ['Central Bohemian dialect', 'Eastern Bohemian dialect', 'Western Bohemian dialect',
|
||
'Moravian dialect', 'Silesian dialect'],
|
||
'Danish': ['Standard Danish', 'Jutlandic dialect', 'Funen dialect', 'Zealandic dialect', 'Bornholmian dialect'],
|
||
'Dutch': ['Flemish', 'Brabantian', 'Limburgish', 'Zeelandic', 'Gronings', 'Frisian Dutch', 'Achterhoeks',
|
||
'Twents', 'Hollandic', 'South Guelderish', 'East Flemish'],
|
||
'English': ['British English', 'American English', 'Australian English', 'Canadian English', 'Indian English',
|
||
'South African English', 'New Zealand English', 'Irish English', 'Scottish English',
|
||
'Caribbean English', 'Nigerian English'],
|
||
'Esperanto': ['European Esperanto', 'Asian Esperanto', 'American Esperanto', 'African Esperanto',
|
||
'Australian Esperanto'],
|
||
'Estonian': ['North Estonian dialect', 'South Estonian dialect', 'Mulgi dialect', 'Seto dialect',
|
||
'Võro dialect'],
|
||
'Finnish': ['Southern Finnish dialect', 'Western Finnish dialect', 'Eastern Finnish dialect',
|
||
'Northern Finnish dialect', 'Karelian dialect', 'Inari Sami dialect', 'Skolt Sami dialect'],
|
||
'French': ['Metropolitan French', 'Quebec French', 'Acadian French', 'Cajun French',
|
||
'African French Variants (e.g., Senegalese, Ivorian, etc.)',
|
||
'Caribbean French (e.g., Haitian Creole)', 'Louisiana Creole French'],
|
||
'Frisian': ['West Frisian', 'North Frisian', 'Saterland Frisian'],
|
||
'Galician': ['Western Galician', 'Eastern Galician', 'Fala (Leonese-Galician dialect)'],
|
||
'Georgian': ['Kartvelian (Standard Georgian)', 'Mingrelian', 'Laz', 'Svan', 'Megruli', 'Imeretian', 'Rachan',
|
||
'Lechkhumian', 'Guria', 'Adjarian', 'Imerkhevian', 'Racha-Lechkhumian'],
|
||
'German': ['Standard High German (Hochdeutsch)', 'Bavarian German', 'Austrian German', 'Swiss German',
|
||
'Low German (Plattdeutsch)', 'Luxembourgish German', 'Pennsylvania Dutch (Amish German)'],
|
||
'Greek': ['Standard Greek (Katharevousa)', 'Demotic Greek (Modern Greek)', 'Cypriot Greek', 'Pontic Greek',
|
||
'Cappadocian Greek', 'Tsakonian', 'Maniot Greek'],
|
||
'Gujrati': ['Standard Gujarati', 'Surti Gujarati', 'Kathiawadi Gujarati', 'Kutchi Gujarati',
|
||
'Charotari Gujarati', 'Parsi Gujarati'],
|
||
'Haitian Creole': ['Standard Haitian Creole (Kreyòl Ayisyen)', 'Northwest Haitian Creole',
|
||
'Southern Haitian Creole', 'Eastern Haitian Creole', 'Central Haitian Creole',
|
||
'Jérémien (spoken in Jérémie)'],
|
||
'Hausa': ['Standard Hausa', 'Kano Hausa', 'Katsina Hausa', 'Sokoto Hausa', 'Zaria Hausa', 'Gobir Hausa',
|
||
'Kebbi Hausa', 'Bauchi Hausa'],
|
||
'Hawaiian': ['Standard Hawaiian', 'Pidgin Hawaiian', 'Hawaiian Creole English (HCE)'],
|
||
'Hebrew': ['Standard Hebrew', 'Mizrahi Hebrew', 'Sephardic Hebrew', 'Ashkenazi Hebrew', 'Yemenite Hebrew'],
|
||
'Hindi': ['Standard Hindi', 'Braj Bhasha', 'Awadhi', 'Bhojpuri', 'Haryanvi', 'Rajasthani', 'Magahi', 'Maithili',
|
||
'Chhattisgarhi', 'Khariboli', 'Kumaoni', 'Garhwali', 'Khari Boli', 'Bundeli', 'Kannauji', 'Marwari',
|
||
'Hindustani', 'Eastern Hindi', 'Western Hindi', 'Central Hindi', 'Pahari'],
|
||
'Hmong': ['White Hmong (Hmoob Dawb)', 'Green Hmong (Hmoob Leeg)', 'Blue Hmong (Hmoob Ntsuab)',
|
||
'Chuanqiandian (Western Hmong)'],
|
||
'Hungarian': ['Standard Hungarian', 'Northern Hungarian', 'Western Hungarian', 'Eastern Hungarian',
|
||
'Southern Hungarian', 'Transylvanian Hungarian', 'Slovak Hungarian', 'Croatian Hungarian',
|
||
'Slovenian Hungarian', 'Serbian Hungarian', 'Ukrainian Hungarian', 'Romanian Hungarian'],
|
||
'Icelandic': ['Standard Icelandic', 'Western Icelandic', 'Eastern Icelandic', 'Northern Icelandic',
|
||
'Southern Icelandic', 'Reykjavík Icelandic'],
|
||
'Igbo': ['Standard Igbo (Central Igbo)', 'Ika Igbo', 'Ikwerre Igbo', 'Onitsha Igbo', 'Owerri Igbo', 'Ngwa Igbo',
|
||
'Enuani Igbo', 'Nri-Igbo', 'Afikpo Igbo', 'Abiriba Igbo', 'Ohuhu Igbo', 'Aro Igbo', 'Igala Igbo',
|
||
'Ekpeye Igbo'],
|
||
'Indonesian': ['Standard Indonesian (Bahasa Indonesia)', 'Javanese', 'Sundanese', 'Balinese', 'Minangkabau',
|
||
'Acehnese', 'Buginese', 'Makassarese', 'Toraja', 'Batak (Toba, Karo, Mandailing, etc.)',
|
||
'Dayak (various dialects)', 'Papuan languages (various)'],
|
||
'Irish': ['Munster Irish (Gaeilge na Mumhan)', 'Connacht Irish (Gaeilge Chonnacht)',
|
||
'Ulster Irish (Gaeilge Uladh)', 'Leinster Irish (Gaeilge Laighean)',
|
||
'Gaeilge Shasana (Irish in England)'],
|
||
'Italian': ['Standard Italian (Italiano Standard)', 'Tuscan Italian (Italiano Toscano)', 'Sicilian (Siciliano)',
|
||
'Venetian (Veneto)', 'Lombard (Lombardo)', 'Neapolitan (Napoletano)', 'Piedmontese (Piemontese)',
|
||
'Emilian-Romagnol (Emiliano-Romagnolo)', 'Calabrian (Calabrese)', 'Sardinian (Sardo)',
|
||
'Apulian (Pugliese)', 'Sicilian (Siciliano)', 'Ligurian (Ligure)', 'Umbrian (Umbro)',
|
||
'Friulian (Friulano)', 'Sicilian (Siciliano)', 'Sardinian (Sardo)', 'Marchigian (Marchigiano)',
|
||
'Abruzzese (Abruzzese)', 'Molisan (Molisano)', 'Campano (Campano)', 'Romanesco (Romanesco)',
|
||
'Lazio (Laziale)', 'Umbrian (Umbro)', 'Sabino (Sabino)', 'Aretino (Aretino)', 'Tuscan (Toscano)',
|
||
'Luccan (Lucchese)', 'Pisan (Pisano)', 'Sienese (Senese)', 'Corsican (Corsu)',
|
||
'Sicilian (Sicilianu)', 'Sardinian (Sardu)', 'Ladin (Ladin)', 'Friulian (Friulano)',
|
||
'Mòcheno (Mòcheno)', 'Cimbrian (Cimbro)'],
|
||
'Japanese': ['Standard Japanese (Hyojungo)', 'Kansai dialect (Kansai-ben)', 'Kanto dialect (Kanto-ben)',
|
||
'Tohoku dialect (Tohoku-ben)', 'Kyushu dialect (Kyushu-ben)', 'Okinawan dialect (Okinawan)',
|
||
'Yamagata dialect (Yamagata-ben)', 'Nagoya dialect (Nagoya-ben)', 'Osaka dialect (Osaka-ben)',
|
||
'Hiroshima dialect (Hiroshima-ben)', 'Kagoshima dialect (Kagoshima-ben)',
|
||
'Kumamoto dialect (Kumamoto-ben)', 'Shikoku dialect (Shikoku-ben)', 'Iwate dialect (Iwate-ben)',
|
||
'Akita dialect (Akita-ben)', 'Oita dialect (Oita-ben)', 'Kochi dialect (Kochi-ben)',
|
||
'Nagasaki dialect (Nagasaki-ben)', 'Fukui dialect (Fukui-ben)', 'Aomori dialect (Aomori-ben)',
|
||
'Yamaguchi dialect (Yamaguchi-ben)', 'Shizuoka dialect (Shizuoka-ben)'],
|
||
'Javanese': ['Standard Javanese (Ngoko)', 'High Javanese (Krama)', 'Low Javanese (Madya)', 'Bantenese Javanese',
|
||
'Osing Javanese', 'Surinamese Javanese'],
|
||
'Kannada': ['Standard Kannada', 'Northern Kannada', 'Southern Kannada', 'Uttara Kannada', 'Havyaka Kannada',
|
||
'Malnad Kannada', 'Mangalorean Kannada', 'Gulbarga Kannada', 'Shimoga Kannada', 'Dharwad Kannada',
|
||
'Kundagannada', 'Are Bhashe'],
|
||
'Kazak': ['Standard Kazakh', 'Southern Kazakh', 'Eastern Kazakh', 'Western Kazakh', 'Northern Kazakh',
|
||
'Kazakh spoken in China', 'Kazakh spoken in Mongolia', 'Kazakh spoken in Russia',
|
||
'Kazakh spoken in Turkmenistan', 'Kazakh spoken in Uzbekistan', 'Kazakh spoken in Iran'],
|
||
'Khmer': ['Standard Khmer', 'Northern Khmer', 'Central Khmer', 'Southern Khmer',
|
||
'Khmer Krom (Cambodian Vietnamese)', 'Cardamom Khmer', 'Western Khmer', 'Eastern Khmer'],
|
||
'Kinyarwanda': ['Standard Kinyarwanda', 'Northern Kinyarwanda', 'Southern Kinyarwanda', 'Eastern Kinyarwanda',
|
||
'Western Kinyarwanda', 'Kinyarwanda spoken in Uganda', 'Kinyarwanda spoken in Tanzania',
|
||
'Kinyarwanda spoken in Burundi', 'Kinyarwanda spoken in the Democratic Republic of Congo'],
|
||
'Korean': ['Standard Korean (Seoul Korean)', 'Pyongan Korean', 'Hamgyong Korean', 'Hwanghae Korean',
|
||
'Gyeonggi Korean', 'Chungcheong Korean', 'Jeolla Korean', 'Gyeongsang Korean', 'Jeju Korean',
|
||
'Yanbian Korean (spoken in China)'],
|
||
'Kurdish': ['Kurmanji Kurdish', 'Sorani Kurdish', 'Zaza Kurdish', 'Gorani Kurdish', 'Hewrami Kurdish',
|
||
'Laki Kurdish', 'Southern Kurdish'],
|
||
'Kyrgyz': ['Chuy Kyrgyz', 'Talas Kyrgyz', 'Naryn Kyrgyz', 'Issyk-Kul Kyrgyz', 'Osh Kyrgyz', 'Batken Kyrgyz',
|
||
'Zhetisu Kyrgyz', 'Pamir Kyrgyz'],
|
||
'Lao': ['Standard Lao', 'Luang Prabang Lao', 'Vientiane Lao', 'Southern Lao', 'Northern Lao', 'Eastern Lao',
|
||
'Western Lao', 'Boloven Plateau Lao', 'Hmong-Mien Lao', 'Chinese Lao'],
|
||
'Latvian': ['Central Latvian', 'Latgalian (High Latvian)', 'Selonian', 'Semigallian', 'Couronian',
|
||
'Kurzeme Latvian', 'Vidzeme Latvian', 'Zemgale Latvian', 'Northern Latvian', 'Eastern Latvian',
|
||
'Livonian'],
|
||
'Lithuanian': ['Aukštaitian Lithuanian (Highland Lithuanian)', 'Samogitian Lithuanian', 'Dzūkian Lithuanian',
|
||
'Suvalkian Lithuanian', 'Klaipėda Lithuanian', 'West Highland Lithuanian',
|
||
'East Highland Lithuanian', 'West Dzūkian Lithuanian', 'East Dzūkian Lithuanian'],
|
||
'Luxembourgish': ['Standard Luxembourgish', 'Eifel Luxembourgish', 'Moselle Luxembourgish',
|
||
'Gutland Luxembourgish', 'Arelerland Luxembourgish'],
|
||
'Macedonian': ['Central Macedonian', 'Western Macedonian', 'Eastern Macedonian', 'Northern Macedonian',
|
||
'Southern Macedonian', 'Pirin Macedonian', 'Vardar Macedonian', 'Mala Prespa Macedonian',
|
||
'Golo Brdo Macedonian', 'Maleševo-Pirin Macedonian'],
|
||
'Malagasy': ['Merina Malagasy (Highland Malagasy)', 'Betsimisaraka Malagasy', 'Southern Malagasy',
|
||
'Northern Malagasy', 'Western Malagasy', 'Antankarana Malagasy', 'Bara Malagasy',
|
||
'Antaisaka Malagasy', 'Antaifasy Malagasy', 'Sakalava Malagasy', 'Tandroy-Mahafaly Malagasy',
|
||
'Antanosy Malagasy'],
|
||
'Malay': ['Standard Malay (Bahasa Melayu)', 'Peninsular Malay', 'Malaysian Malay', 'Singaporean Malay',
|
||
'Bruneian Malay', 'Indonesian Malay (Bahasa Indonesia)', 'Sumatran Malay (Minangkabau)',
|
||
'Javanese Malay (Bahasa Jawa)', 'Balinese Malay (Bahasa Bali)', 'Papuan Malay (Bahasa Papua)',
|
||
'Bornean Malay (Bahasa Borneo)', 'Ambonese Malay (Bahasa Ambon)', 'Manado Malay (Bahasa Manado)',
|
||
'Banjarese Malay (Banjarese)', 'Kelantan-Pattani Malay', 'Riau Malay (Bahasa Riau)',
|
||
'Bengkulu Malay (Bahasa Bengkulu)', 'Bangka Malay (Bahasa Bangka)',
|
||
'Palembang Malay (Bahasa Palembang)', 'Lampung Malay (Bahasa Lampung)',
|
||
'Rejang Malay (Bahasa Rejang)', 'Sri Lankan Malay', 'Cocos Malay (Bahasa Cocos)',
|
||
'Christmas Island Malay', 'Papuan Malay (Bahasa Papua)'],
|
||
'Malayalam': ['Central Kerala Malayalam', 'Northern Kerala Malayalam', 'Southern Kerala Malayalam',
|
||
'Malabar Malayalam', 'Palakkad Malayalam', 'Travancore Malayalam', 'Kasaragod Malayalam',
|
||
'Lakshadweep Malayalam', 'Malaysian Malayalam', 'Singaporean Malayalam', 'Gulf Malayalam',
|
||
'Sri Lankan Malayalam'],
|
||
'Maltese': ['Standard Maltese (Maltese)', 'Northern Maltese', 'Southern Maltese', 'Western Maltese',
|
||
'Central Maltese', 'Gozo Maltese'],
|
||
'Maori': ["Northland Maori", "Ngāti Porou", "Tuhoe", "Ngāti Maniapoto", "Rapa", "Rapa Iti", "Rapa Motu"],
|
||
'Marathi': ["Standard Marathi", "Ahirani", "Kokani", "Varhadi", "Dangi", "Khandeshi", "Deshastha", "Karhade",
|
||
"Konkani Marathi", "Nagpuri Marathi", "Sangli Konkan", "Junnar Konkan", "Thane Konkan",
|
||
"Ahmednagar Konkan", "Pune Konkan", "Solapur Konkan"],
|
||
'Mayanmar': ["Standard Burmese", "Rakhine", "Mon", "Shan", "Kachin", "Chin", "Karen", "Kayah", "Pa'O", "Intha",
|
||
"Myeik", "Tavoy", "Moken", "Burmese Sign Language"],
|
||
'Mongolian': ["Khalkha Mongolian", "Buryat Mongolian", "Oirat Mongolian", "Kalmyk Mongolian",
|
||
"Khorchin Mongolian", "Kharchin Mongolian", "Chakhar Mongolian", "Ordos Mongolian",
|
||
"Inner Mongolian", "Alasha Mongolian", "Daur Mongolian"],
|
||
'Nepali': ["Standard Nepali", "Eastern Pahari", "Western Pahari", "Doteli", "Kumaoni", "Darai", "Jumli",
|
||
"Bajhangi", "Humli", "Sherpa", "Tamang", "Bhutia", "Lepcha", "Gurung", "Limbu", "Newari", "Magar",
|
||
"Thami", "Chepang", "Rai", "Kusundha", "Bote", "Surel", "Mewahang", "Raute", "Raji", "Yakkha",
|
||
"Thulung", "Dolpa", "Nawari", "Rokka", "Nepal Bhasa", "Danphe"],
|
||
'Norwegian': ["Bokmål (Standard Norwegian)", "Nynorsk", "Northern Norwegian", "Southern Norwegian",
|
||
"Eastern Norwegian", "Western Norwegian", "Trøndelag", "Nordland", "Troms", "Finnmark",
|
||
"Telemark", "Agder", "Vestlandet", "Møre og Romsdal", "Trøndelag", "Nordland", "Troms",
|
||
"Svalbard", "Kven", "Romanian Norwegian", "Scots Norwegian", "Tavringer Norwegian",
|
||
"Yiddish Norwegian", "Rotwelsch Norwegian", "Traveller Norwegian"],
|
||
'Nyanja': ["Chichewa (Standard Nyanja)", "Chinyanja", "Chiyao", "Chisena", "Chindali", "Chitumbuka",
|
||
"Chimwanja", "Chimaravi", "Chikunda", "Chilambya", "Chingoni", "Chinyakyusa", "Chisukwa", "Chisenga",
|
||
"Chimanga", "Chimvende", "Chikamanga", "Chikunda", "Chilambya", "Chilomoni", "Chinamwanga"],
|
||
'Odia': ["Standard Odia (Standard Oriya)", "Balasore Odia", "Baleswari Odia", "Ganjam Odia", "Sambalpuri Odia",
|
||
"Kalahandi Odia", "Koraput Odia", "Cuttack Odia", "Phulbani Odia", "Baudh Odia", "Sonepur Odia",
|
||
"Bolangir Odia", "Nuapada Odia", "Jajpur Odia", "Mayurbhanj Odia", "Kendrapara Odia", "Kendujhar Odia",
|
||
"Bhadrak Odia", "Puri Odia", "Gajapati Odia", "Nayagarh Odia", "Rayagada Odia", "Kandhamal Odia"],
|
||
'Pashto': ["Northern Pashto (Peshawar, Mardan)", "Southern Pashto (Quetta, Kandahar)",
|
||
"Central Pashto (Kabul, Logar)", "Western Pashto (Herat, Farah)",
|
||
"Eastern Pashto (Nangarhar, Kunar)", "Yusufzai Pashto", "Wazirwola Pashto", "Kandahari Pashto",
|
||
"Khosti Pashto", "Ghilji Pashto", "Mangal Khel Pashto", "Tani Pashto", "Durrani Pashto",
|
||
"Zadran Pashto", "Afridi Pashto", "Shinwari Pashto", "Mashwani Pashto", "Marwat Pashto",
|
||
"Mahsudi Pashto"],
|
||
'Persian': ["Standard Persian (Farsi)", "Tehrani Persian", "Isfahani Persian", "Shirazi Persian",
|
||
"Kermani Persian", "Yazdi Persian", "Mazandarani Persian", "Gilan Persian", "Taleshi Persian",
|
||
"Khorasani Persian", "Yazdi Persian", "Larestani Persian", "Bakhtiari Persian", "Luri Persian",
|
||
"Loristani Persian", "Khuzestani Persian", "Bandari Persian", "Qashqai Persian", "Balochi Persian",
|
||
"Afghan Persian (Dari)"],
|
||
'Polish': ["Standard Polish", "Greater Polish (Wielkopolski)", "Lesser Polish (Małopolski)",
|
||
"Silesian (Śląski)", "Kashubian (Kaszubski)", "Masovian (Mazowiecki)", "Podlasian (Podlaski)",
|
||
"Warmian-Masurian (Warmińsko-Mazurski)", "Pomeranian (Pomorski)", "Kuyavian (Kujawski)",
|
||
"Sandomierzian (Sandomierski)", "Podhale (Podhalański)", "Lemko (Lemkowski)",
|
||
"Łowicz dialect (Łowicki)", "Kresy dialect (Kresowy)", "Wilamowicean (Wilamowicki)",
|
||
"Górale (Goralski)", "Kaszuby (Kaszubski)", "Poznań (Poznański)", "Płock (Płocki)",
|
||
"Kielce (Kielecki)", "Łódź (Łódzki)", "Lublin (Lubelski)", "Rzeszów (Rzeszowski)",
|
||
"Cracow (Krakowski)", "Warsaw (Warszawski)", "Białystok (Białostocki)", "Olsztyn (Olsztyński)",
|
||
"Gdańsk (Gdański)", "Toruń (Toruński)", "Bydgoszcz (Bydgoski)", "Szczecin (Szczeciński)",
|
||
"Wrocław (Wrocławski)", "Opole (Opolski)", "Kołobrzeg (Kołobrzeski)", "Mazurian (Mazurski)"],
|
||
'Portugese': ["Standard Portuguese (Português Padrão)", "European Portuguese (Português Europeu)",
|
||
"Brazilian Portuguese (Português Brasileiro)", "African Portuguese (Português Africano)",
|
||
"Angolan Portuguese (Português Angolano)", "Mozambican Portuguese (Português Moçambicano)",
|
||
"Cape Verdean Portuguese (Português Cabo-Verdiano)",
|
||
"São Tomean Portuguese (Português Santomense)",
|
||
"Guinea-Bissau Portuguese (Português da Guiné-Bissau)",
|
||
"East Timorese Portuguese (Português Timorense)", "Goan Portuguese (Konkani)",
|
||
"Macanese Portuguese (Patuá)", "Daman and Diu Portuguese (Konkani)",
|
||
"Malabar Portuguese (Malayalam)", "Brazilian Amazon Portuguese (Português da Amazônia)"],
|
||
'Punjabi': ["Standard Punjabi (Punjabi)", "Lahnda (Western Punjabi)", "Majhi (Majhi Punjabi)",
|
||
"Doabi (Doabi Punjabi)", "Malwi (Malwai Punjabi)", "Pothohari (Pothohari Punjabi)",
|
||
"Saraiki (Saraiki Punjabi)", "Hindko (Hindko Punjabi)", "Jhangvi (Jhangvi Punjabi)",
|
||
"Rathi (Rathi Punjabi)", "Khetrani (Khetrani Punjabi)", "Chadri (Chadri Punjabi)",
|
||
"Jandali (Jandali Punjabi)", "Kohistani (Kohistani Punjabi)", "Khetran (Khetran Punjabi)",
|
||
"Lekhi (Lekhi Punjabi)", "Multani (Multani Punjabi)", "Shahpuri (Shahpuri Punjabi)",
|
||
"Derawali (Derawali Punjabi)", "Ghebi (Ghebi Punjabi)"],
|
||
'Romanian': ["Standard Romanian (Limba Română Standard)", "Moldavian Romanian (Limba Moldovenească)",
|
||
"Transylvanian Romanian (Limba Transilvană)", "Banat Romanian (Limba Bănățeană)",
|
||
"Oltenian Romanian (Limba Olteniană)", "Muntenian Romanian (Limba Munteniană)",
|
||
"Aromanian (Limba Armâneashti)", "Megleno-Romanian (Limba Meglenoromână)",
|
||
"Istro-Romanian (Limba Istroromână)", "Romanian Sign Language (Limbaj mimico-gestual românesc)"],
|
||
'Russian': ["Standard Russian (Русский язык)", "Moscow Russian (Московский диалект)",
|
||
"St. Petersburg Russian (Петербургский диалект)", "Southern Russian (Южнорусский диалект)",
|
||
"Northern Russian (Северорусский диалект)", "Western Russian (Западнорусский диалект)",
|
||
"Eastern Russian (Восточнорусский диалект)", "Central Russian (Центральнорусский диалект)",
|
||
"Siberian Russian (Сибирский диалект)", "Ural Russian (Уральский диалект)",
|
||
"Volga Russian (Поволжский диалект)", "Karelian Russian (Карельский диалект)",
|
||
"Tatar Russian (Татарский диалект)", "Bashkir Russian (Башкирский диалект)",
|
||
"Yakut Russian (Якутский диалект)", "Kalmyk Russian (Калмыцкий диалект)",
|
||
"Chuvash Russian (Чувашский диалект)", "Udmurt Russian (Удмуртский диалект)",
|
||
"Moksha Russian (Мокшанский диалект)", "Erzya Russian (Эрзянский диалект)",
|
||
"Komi Russian (Коми-пермяцкий диалект)", "Mari Russian (Марийский диалект)",
|
||
"Ukrainian Russian (Украинский диалект)", "Belarusian Russian (Белорусский диалект)",
|
||
"Kazakh Russian (Казахский диалект)", "Kyrgyz Russian (Киргизский диалект)",
|
||
"Tajik Russian (Таджикский диалект)", "Turkmen Russian (Туркменский диалект)",
|
||
"Uzbek Russian (Узбекский диалект)", "Avar Russian (Аварский диалект)",
|
||
"Chechen Russian (Чеченский диалект)", "Dagestani Russian (Дагестанский диалект)",
|
||
"Ingush Russian (Ингушский диалект)", "Kumyk Russian (Кумыкский диалект)",
|
||
"Lezgian Russian (Лезгинский диалект)", "North Caucasian Russian (Северокавказский диалект)",
|
||
"Buryat Russian (Бурятский диалект)", "Khakas Russian (Хакасский диалект)",
|
||
"Tuvan Russian (Тувинский диалект)", "Altai Russian (Алтайский диалект)",
|
||
"Yakut Russian (Якутский диалект)", "Evenki Russian (Эвенкийский диалект)",
|
||
"Chukchi Russian (Чукотский диалект)", "Koryak Russian (Корякский диалект)",
|
||
"Nenets Russian (Ненецкий диалект)", "Khanty-Mansi Russian (Ханты-мансийский диалект)",
|
||
"Nenets Russian (Ненецкий диалект)", "Selkup Russian (Селькупский диалект)",
|
||
"Komi-Permyak Russian (Коми-пермяцкий диалект)", "Mordvin Russian (Мордовский диалект)",
|
||
"Mari El Russian (Марийский диалект)", "Udmurt Russian (Удмуртский диалект)",
|
||
"Komi Russian (Коми-зырянский диалект)", "Nenets Russian (Ненецкий диалект)",
|
||
"Khanty Russian (Хантыйский диалект)", "Mansi Russian (Мансийский диалект)",
|
||
"Komi-Permyak Russian (Коми-пермяцкий диалект)", "Mordvin Russian (Мордовский диалект)",
|
||
"Mari El Russian (Марийский диалект)", "Udmurt Russian (Удмуртский диалект)",
|
||
"Erzya Russian (Эрзянский диалект)", "Moksha Russian (Мокшанский диалект)",
|
||
"Komi-Zyryan Russian (Коми-зырянский диалект)", "Udmurt Russian (Удмуртский диалект)",
|
||
"Khanty Russian (Хантыйский диалект)", "Mansi Russian (Мансийский диалект)",
|
||
"Nenets Russian (Ненецкий диалект)", "Selkup Russian (Селькупский диалект)",
|
||
"Evenki Russian (Эвенкийский диалект)", "Chukchi Russian (Чукотский диалект)",
|
||
"Koryak Russian (Корякский диалект)", "Nenets Russian (Ненецкий диалект)",
|
||
"Khanty-Mansi Russian (Ханты-мансийский диалект)", "Yukaghir Russian (Юкагирский диалект)",
|
||
"Chulym Russian (Чулымский диалект)", "Kamas Russian (Камасский диалект)",
|
||
"Yugh Russian (Югский диалект)", "Ket Russian (Кетский диалект)",
|
||
"Nganasan Russian (Нганасанский диалект)", "Enets Russian (Энецкий диалект)",
|
||
"Nivkh Russian (Нивхский диалект)", "Aleut Russian (Алеутский диалект)",
|
||
"Chuvan Russian (Чуванский диалект)", "Nenets Russian (Ненецкий диалект)",
|
||
"Selkup Russian (Селькупский диалект)", "Kamassian Russian (Камасский диалект)",
|
||
"Yukaghir Russian (Юкагирский диалект)", "Chulym Russian (Чулымский диалект)"],
|
||
'Samoan': ["Samoan (Gagana Samoa)", "Samoan Sign Language (Samoan Saini Gagana)",
|
||
"Tokelauan (Te Gagana Tokelau)", "Futunan (Faka Futuna)", "Amerika Sāmoan (Gagana Samoa Amerika)",
|
||
"Samoan Aotearoa (Samoan New Zealand)", "Samoan Australia (Samoan Australia)"],
|
||
'Serbian': ["Standard Serbian (Srpski jezik)", "Ekavian Serbian (Ekavski Srpski)",
|
||
"Ijekavian Serbian (Ijekavski Srpski)", "Shtokavian Serbian (Shtokavski Srpski)",
|
||
"Kosovar Serbian (Kosovski Srpski)", "Montenegrin Serbian (Crnogorski Srpski)",
|
||
"Bunjevac Serbian (Bunjevački Srpski)", "Molise Serbian (Molizanski Srpski)",
|
||
"Torlakian Serbian (Torlački Srpski)", "Pannonian Serbian (Panonski Srpski)",
|
||
"Podrinje Serbian (Podrinski Srpski)", "Srem Serbian (Sremski Srpski)",
|
||
"Timok Serbian (Timočki Srpski)", "Rascian Serbian (Raški Srpski)", "Backa Serbian (Bački Srpski)",
|
||
"Backa Palanka Serbian (Bačkopalanački Srpski)", "Banat Serbian (Banatski Srpski)",
|
||
"Syrmian Serbian (Srijemski Srpski)", "Vojvodina Serbian (Vojvođanski Srpski)",
|
||
"Kosovo Serbian (Kosovski Srpski)", "Krajina Serbian (Krajinski Srpski)",
|
||
"Macedonian Serbian (Makedonski Srpski)", "Bulgarian Serbian (Bugarski Srpski)",
|
||
"Romanian Serbian (Rumunski Srpski)", "Albanian Serbian (Albanski Srpski)",
|
||
"Hungarian Serbian (Mađarski Srpski)", "Slovak Serbian (Slovački Srpski)",
|
||
"Croatian Serbian (Hrvatski Srpski)", "Slovenian Serbian (Slovenački Srpski)",
|
||
"Bosnian Serbian (Bosanski Srpski)", "Herzegovinian Serbian (Hercegovački Srpski)",
|
||
"Bosniak Serbian (Bosnjački Srpski)", "Cyrillic Serbian (Ćirilski Srpski)",
|
||
"Latin Serbian (Latinčki Srpski)", "Goražde Serbian (Goraždanski Srpski)",
|
||
"Sjenica Serbian (Sjenički Srpski)", "Pester Serbian (Pesterski Srpski)",
|
||
"Dubrovnik Serbian (Dubrovački Srpski)", "Pridvorica Serbian (Pridvorički Srpski)",
|
||
"Zagreb Serbian (Zagrebački Srpski)", "Zemun Serbian (Zemunski Srpski)",
|
||
"Pancevo Serbian (Pančevački Srpski)", "Belgrade Serbian (Beogradski Srpski)"],
|
||
'Scots Gaelic': ["Scottish Gaelic (Gàidhlig)", "Southern Gaelic (Gàidhlig na Ceiltis)",
|
||
"Northern Gaelic (Gàidhlig a Tuath)", "Hebridean Gaelic (Gàidhlig Innse Gall)",
|
||
"Island Gaelic (Gàidhlig Eileanach)", "Mainland Gaelic (Gàidhlig Tir-Mòr)",
|
||
"Canadian Gaelic (Gàidhlig Chanada)", "Nova Scotia Gaelic (Gàidhlig Alba Nuadh)",
|
||
"Cape Breton Gaelic (Gàidhlig Eilean Cheap Breatuinn)",
|
||
"Newfoundland Gaelic (Gàidhlig Talamh an Éisc)",
|
||
"Prince Edward Island Gaelic (Gàidhlig Eilean a' Phrionnsa)",
|
||
"American Gaelic (Gàidhlig Ameireaganach)", "Cape Fear Gaelic (Gàidhlig Cuithir a' Mhuilinn)",
|
||
"Mabou Gaelic (Gàidhlig an Mhàbu)", "South Uist Gaelic (Gàidhlig Uibhist a Deas)",
|
||
"North Uist Gaelic (Gàidhlig Uibhist a Tuath)", "Barra Gaelic (Gàidhlig Bharraidh)",
|
||
"Lewis Gaelic (Gàidhlig Leòdhais)", "Harris Gaelic (Gàidhlig na Hearadh)",
|
||
"Skye Gaelic (Gàidhlig an Eilein Sgitheanaich)", "Raasay Gaelic (Gàidhlig an Eilein Ràsaigh)",
|
||
"Mull Gaelic (Gàidhlig an Eilein Mhuilich)", "Morvern Gaelic (Gàidhlig A' Mhorbhairn)",
|
||
"Argyll Gaelic (Gàidhlig Earra-Ghàidheal)", "Kintyre Gaelic (Gàidhlig an Cinn Tìre)",
|
||
"Arran Gaelic (Gàidhlig Arainn)", "Bute Gaelic (Gàidhlig Bhòid)",
|
||
"Glasgow Gaelic (Gàidhlig Ghlaschu)", "Edinburgh Gaelic (Gàidhlig Dhùn Èideann)",
|
||
"Inverness Gaelic (Gàidhlig Inbhir Nis)", "Aberdeen Gaelic (Gàidhlig Obar Dheathain)",
|
||
"Dundee Gaelic (Gàidhlig Dhùn Dèagh)", "Perth Gaelic (Gàidhlig Pheairt)",
|
||
"Stirling Gaelic (Gàidhlig Sruighlea)", "Dunfermline Gaelic (Gàidhlig Dhùn Phàrlain)",
|
||
"Ayr Gaelic (Gàidhlig Inbhir Àir)", "Kilmarnock Gaelic (Gàidhlig Cille Mheàrnaig)",
|
||
"Dumfries Gaelic (Gàidhlig Dùn Phris)", "Galloway Gaelic (Gàidhlig Ghallghaidhealaibh)",
|
||
"Isle of Man Gaelic (Gaelg)", "Irish Gaelic (Gaeilge)",
|
||
"Scottish Gaelic Sign Language (Gàidhlig Innse Gall Comharra-cùrsa)"],
|
||
'Sesotho': ["Standard Sesotho", "Northern Sesotho (Pedi)", "Southern Sesotho (Sesotho)", "Western Sesotho",
|
||
"Central Sesotho", "Sesotho sa Leboa", "Sesotho sa Borwa", "Sesotho sa Manala",
|
||
"Sesotho sa Leholimo", "Sesotho sa Mokgalwaneng", "Sesotho sa Natala", "Sesotho sa Leribe",
|
||
"Sesotho sa Qwaqwa", "Sesotho sa Tlholong", "Sesotho sa Khubelu", "Sesotho sa Holosi",
|
||
"Sesotho sa Thabana-Morena", "Sesotho sa Kwebulu", "Sesotho sa Mokhorong", "Sesotho sa Thoteng",
|
||
"Sesotho sa Makhaleng", "Sesotho sa Hlakubaneng", "Sesotho sa Ntsube", "Sesotho sa Tholo",
|
||
"Sesotho sa Likhakeng", "Sesotho sa Kholokoe", "Sesotho sa Rantobeng", "Sesotho sa Lefikeng",
|
||
"Sesotho sa Mafeteng", "Sesotho sa Mohale's Hoek", "Sesotho sa Quthing", "Sesotho sa Qacha's Nek",
|
||
"Sesotho sa Mokhotlong", "Sesotho sa Thaba-Tseka", "Sesotho sa Mantsonyane", "Sesotho sa Moyeni",
|
||
"Sesotho sa Borutho", "Sesotho sa Phamong", "Sesotho sa Ha Ntsi", "Sesotho sa Holamakwane",
|
||
"Sesotho sa Lejone", "Sesotho sa Mapoteng", "Sesotho sa Sempe", "Sesotho sa Taung",
|
||
"Sesotho sa Maqheku", "Sesotho sa Sekoting", "Sesotho sa Sethonjang", "Sesotho sa Senekal",
|
||
"Sesotho sa Mopeli", "Sesotho sa Maqheleng", "Sesotho sa Tšikwane", "Sesotho sa Taung",
|
||
"Sesotho sa Sekoting", "Sesotho sa Khoelenya", "Sesotho sa Hlokoa", "Sesotho sa Maolong",
|
||
"Sesotho sa Mahobong", "Sesotho sa Khoelenya", "Sesotho sa Thaba-Bosiu", "Sesotho sa Qalabane",
|
||
"Sesotho sa Pitseng", "Sesotho sa Lenteleng", "Sesotho sa Mateleng", "Sesotho sa Phaila",
|
||
"Sesotho sa Bobete", "Sesotho sa Khoara", "Sesotho sa Ramatšeliso", "Sesotho sa Ts'akholo",
|
||
"Sesotho sa Sakoane", "Sesotho sa Linotšing", "Sesotho sa Mabatšoana", "Sesotho sa Tšoeneng",
|
||
"Sesotho sa Mahobong", "Sesotho sa Moreneng", "Sesotho sa Ts'akholo", "Sesotho sa Linotšing",
|
||
"Sesotho sa Mabatšoana", "Sesotho sa Ts'enoli", "Sesotho sa Tšepo", "Sesotho sa Tšiu",
|
||
"Sesotho sa Phuthiatsana", "Sesotho sa Khatololang", "Sesotho sa Tšenola", "Sesotho sa Matsatseng",
|
||
"Sesotho sa Thamae", "Sesotho sa Lesia", "Sesotho sa Tholoana", "Sesotho sa Mokhachane",
|
||
"Sesotho sa Khohlong", "Sesotho sa Hlalele", "Sesotho sa Tseko", "Sesotho sa Qacha's Hoek",
|
||
"Sesotho sa Mohotlong", "Sesotho sa St. Martin", "Sesotho sa Noone", "Sesotho sa Sebopo",
|
||
"Sesotho sa Ha Nkau", "Sesotho sa Semoding", "Sesotho sa Sempheteng", "Sesotho sa Tabi",
|
||
"Sesotho sa Makoanyane", "Sesotho sa Quthing", "Sesotho sa Thaba-Putsoa", "Sesotho sa Qalabane",
|
||
"Sesotho sa Leribe", "Sesotho sa Senekal", "Sesotho sa Mafeteng", "Sesotho sa Mohale's Hoek",
|
||
"Sesotho sa Thaba-Matšo", "Sesotho sa Qalabane", "Sesotho sa Taung", "Sesotho sa Sekoting",
|
||
"Sesotho sa Khoelenya", "Sesotho sa Ha Ntsi", "Sesotho sa Holamakwane", "Sesotho sa Lejone",
|
||
"Sesotho sa Mapoteng", "Sesotho sa Sempe", "Sesotho sa Taung", "Sesotho sa Sekoting",
|
||
"Sesotho sa Khoelenya", "Sesotho sa Holamakwane", "Sesotho sa Lejone", "Sesotho sa Mapoteng",
|
||
"Sesotho sa Sempe", "Sesotho sa Taung", "Sesotho sa Sekoting", "Sesotho sa Mokhorong",
|
||
"Sesotho sa Thoteng", "Sesotho sa Likhakeng", "Sesotho sa Kholokoe", "Sesotho sa Rantobeng",
|
||
"Sesotho sa Lefikeng", "Sesotho sa Mafeteng", "Sesotho sa Mohale's Hoek", "Sesotho sa Quthing",
|
||
"Sesotho sa Qacha's Nek", "Sesotho sa Mokhotlong", "Sesotho sa Thaba-Tseka",
|
||
"Sesotho sa Mantsonyane", "Sesotho sa Moyeni", "Sesotho sa Borutho", "Sesotho sa Phamong",
|
||
"Sesotho sa Ha Ntsi", "Sesotho sa Holamakwane"],
|
||
'Shona': ["Standard Shona (chiShona)", "Karanga (chiKaranga)", "Manyika (chiManyika)", "Ndau (chiNdau)",
|
||
"Korekore (chiKorekore)", "Zezuru (chiZezuru)", "Korekore-Mashonaland (chiKorekore-Mashonaland)",
|
||
"Korekore-Mashonaland Central (chiKorekore-Mashonaland Central)",
|
||
"Korekore-Mashonaland East (chiKorekore-Mashonaland East)",
|
||
"Korekore-Mashonaland West (chiKorekore-Mashonaland West)",
|
||
"Korekore-Mashonaland South (chiKorekore-Mashonaland South)",
|
||
"Zezuru-Mashonaland Central (chiZezuru-Mashonaland Central)",
|
||
"Zezuru-Mashonaland East (chiZezuru-Mashonaland East)",
|
||
"Zezuru-Mashonaland West (chiZezuru-Mashonaland West)",
|
||
"Zezuru-Mashonaland South (chiZezuru-Mashonaland South)",
|
||
"Manyika-Mashonaland Central (chiManyika-Mashonaland Central)",
|
||
"Manyika-Mashonaland East (chiManyika-Mashonaland East)",
|
||
"Manyika-Mashonaland West (chiManyika-Mashonaland West)",
|
||
"Manyika-Mashonaland South (chiManyika-Mashonaland South)", "Karanga-Masvingo (chiKaranga-Masvingo)",
|
||
"Karanga-Midlands (chiKaranga-Midlands)", "Karanga-Matabeleland (chiKaranga-Matabeleland)",
|
||
"Ndau-Masvingo (chiNdau-Masvingo)", "Ndau-Midlands (chiNdau-Midlands)",
|
||
"Ndau-Matabeleland (chiNdau-Matabeleland)"],
|
||
'Sindhi': ["Standard Sindhi (سنڌي)", "Sindhi Saraiki (سنڌي سرائيڪي)", "Sindhi Siroli (سنڌي سروڻي)",
|
||
"Sindhi Thari (سنڌي ٿري)", "Sindhi Kachhi (سنڌي ڪڇي)", "Sindhi Lari (سنڌي لاڙي)",
|
||
"Sindhi Vicholi (سنڌي ڏڻي)", "Sindhi Jadgali (سنڌي جدگلي)", "Sindhi Lari (سنڌي لاڙي)",
|
||
"Sindhi Khetrani (سنڌي کهيٽراڻي)", "Sindhi Dukslinu (سنڌي ڍکسلينو)", "Sindhi Macharia (سنڌي مچاريا)",
|
||
"Sindhi Memoni (سنڌي ميمڻي)"],
|
||
'Sinhala': ["Standard Sinhala (සිංහල)", "Up-Country Sinhala (උඹටෙරි සිංහල)", "Southern Sinhala (දකුණු සිංහල)",
|
||
"Sabaragamuwa Sinhala (සබරගමුව සිංහල)", "Central Sinhala (මධුරංගුව සිංහල)",
|
||
"North Western Sinhala (උතුරු වයඹ සිංහල)", "Uva Sinhala (ඌව සිංහල)",
|
||
"Eastern Sinhala (නැගෙනහිර සිංහල)", "North Central Sinhala (උතුරු මධුරංගුව සිංහල)",
|
||
"Western Sinhala (වයඹ සිංහල)", "Southern Sinhala (දකුණු සිංහල)", "Northern Sinhala (උතුරු සිංහල)",
|
||
"Wayamba Sinhala (වයඹ සිංහල)", "Ruhuna Sinhala (රුහුණ සිංහල)",
|
||
"Low-Country Sinhala (පහලනින්ද සිංහල)", "Kandyan Sinhala (මධුරංගුව සිංහල)",
|
||
"Hill Country Sinhala (දකුණු හරිම සිංහල)", "Northern Sinhala (උතුරු සිංහල)"],
|
||
'Slovak': ["Standard Slovak (Slovenčina)", "Central Slovak (Stredoslovenské nárečie)",
|
||
"Western Slovak (Západoslovenské nárečie)", "Eastern Slovak (Východoslovenské nárečie)",
|
||
"Southern Slovak (Južnoslovenské nárečie)", "Košice Slovak (Košické nárečie)",
|
||
"Považie Slovak (Považské nárečie)", "Turiec Slovak (Turčianske nárečie)",
|
||
"Orava Slovak (Oravské nárečie)", "Liptov Slovak (Liptovské nárečie)",
|
||
"Žilina Slovak (Žilinské nárečie)", "Horehronie Slovak (Horehronské nárečie)",
|
||
"Spiš Slovak (Spišské nárečie)", "Gemer Slovak (Gemerské nárečie)",
|
||
"Zemplín Slovak (Zemplínske nárečie)", "Šariš Slovak (Šarišské nárečie)",
|
||
"Hauerland Slovak (Hauerlandské nárečie)", "Lendak Slovak (Lendácky dialekt)",
|
||
"Saris Slovak (Šarišský dialekt)", "Zemplin Slovak (Zemplínsky dialekt)",
|
||
"Novohrad Slovak (Novohradský dialekt)", "Hont Slovak (Hontiansky dialekt)",
|
||
"Horehronie Slovak (Horehronský dialekt)", "Podpoľanie Slovak (Podpoľanský dialekt)",
|
||
"Pohronie Slovak (Pohronský dialekt)", "Turiec Slovak (Turčiansky dialekt)",
|
||
"Orava Slovak (Oravský dialekt)", "Liptov Slovak (Liptovský dialekt)",
|
||
"Kysuce Slovak (Kysucký dialekt)", "Horehronie Slovak (Horehronský dialekt)",
|
||
"Tekov Slovak (Tekovský dialekt)", "Nitra Slovak (Nitriansky dialekt)",
|
||
"Trnava Slovak (Trnavský dialekt)", "Záhorie Slovak (Záhorský dialekt)",
|
||
"Myjava Slovak (Myjavský dialekt)", "Pezinok Slovak (Pezinský dialekt)",
|
||
"Slovak Sign Language (Slovenský znakový jazyk)"],
|
||
'Slovenian': ["Standard Slovenian (Slovenščina)", "Pomurski dialect (Pomursko narečje)",
|
||
"Prekmurski dialect (Prekmursko narečje)", "Prlekija dialect (Prleško narečje)",
|
||
"Štajersko Prekmurski dialect (Štajersko-prekmursko narečje)", "Koranti dialect (Korantščina)",
|
||
"Savinjski dialect (Savinjsko narečje)", "Posavski dialect (Posavsko narečje)",
|
||
"Dolenjski dialect (Dolenjsko narečje)", "Belokranjski dialect (Belokranjsko narečje)",
|
||
"Gorenjski dialect (Gorenjsko narečje)", "Primorski dialect (Primorsko narečje)",
|
||
"Kraški dialect (Kraško narečje)", "Rezijan dialect (Rezijansko narečje)",
|
||
"Hrušiški dialect (Hrušiško narečje)", "Ziljski dialect (Ziljsko narečje)",
|
||
"Zilaški dialect (Zilaško narečje)", "Nadiški dialect (Nadiško narečje)",
|
||
"Tolminski dialect (Tolminsko narečje)", "Cerkno dialect (Cerkljansko narečje)",
|
||
"Goriški dialect (Goriško narečje)", "Brda dialect (Brdsko narečje)",
|
||
"Kras dialect (Kraško narečje)", "Rezijan dialect (Rezijansko narečje)",
|
||
"Solkan dialect (Solkansko narečje)", "Slovenian Sign Language (Slovenski znakovni jezik)"],
|
||
'Somali': ["Standard Somali (Af-Soomaali)",
|
||
"Northern Somali (Af-Dir), Eastern Somali (Af-Qaad), Central Somali (Af-Gaar), Maay (Maay Maay), Benaadir (Af-Maay-Koonfur), Coastal Somali (Af-Brava), Juba (Jubaland), NFD Somali (Northeastern Somali)"],
|
||
'Spanish': ["Standard Spanish (Español)", "Andalusian Spanish (Andaluz)", "Canarian Spanish (Canario)",
|
||
"Castilian Spanish (Castellano)", "Latin American Spanish (Español Latinoamericano)",
|
||
"Argentinian Spanish (Español Argentino)", "Mexican Spanish (Español Mexicano)",
|
||
"Colombian Spanish (Español Colombiano)", "Chilean Spanish (Español Chileno)",
|
||
"Peruvian Spanish (Español Peruano)", "Venezuelan Spanish (Español Venezolano)",
|
||
"Cuban Spanish (Español Cubano)", "Puerto Rican Spanish (Español Puertorriqueño)",
|
||
"Dominican Spanish (Español Dominicano)", "Costa Rican Spanish (Español Costarricense)",
|
||
"Guatemalan Spanish (Español Guatemalteco)", "Honduran Spanish (Español Hondureño)",
|
||
"Nicaraguan Spanish (Español Nicaragüense)", "Salvadoran Spanish (Español Salvadoreño)",
|
||
"Bolivian Spanish (Español Boliviano)", "Ecuadorian Spanish (Español Ecuatoriano)",
|
||
"Paraguayan Spanish (Español Paraguayo)", "Uruguayan Spanish (Español Uruguayo)",
|
||
"Puerto Rican Spanish (Español Puertorriqueño)", "Galician Spanish (Gallego)",
|
||
"Basque Spanish (Euskara)", "Catalan Spanish (Català)", "Valencian Spanish (Valencià)",
|
||
"Balearic Spanish (Balear)", "Aragonese Spanish (Aragonés)", "Asturian Spanish (Asturleonés)",
|
||
"Cantabrian Spanish (Cántabro)", "Aranese Spanish (Aranès)", "Extremaduran Spanish (Extremadura)",
|
||
"Murcian Spanish (Murciano)", "Canarian Spanish (Canario)",
|
||
"Saharan Spanish (Afro-Asiatic Spanish)",
|
||
"Equatorial Guinean Spanish (Español de Guinea Ecuatorial)", "Philippine Spanish (Filipino)",
|
||
"Caribbean Spanish (Caribeño)", "Puerto Rican Spanish (Español Puertorriqueño)",
|
||
"Cuban Spanish (Español Cubano)", "Dominican Spanish (Español Dominicano)",
|
||
"Venezuelan Spanish (Español Venezolano)", "Colombian Spanish (Español Colombiano)",
|
||
"Panamanian Spanish (Español Panameño)", "Costa Rican Spanish (Español Costarricense)",
|
||
"Nicaraguan Spanish (Español Nicaragüense)"],
|
||
'Sundanese': ["Standard Sundanese (Basa Sunda)", "Bantenese (Basa Banten)", "Cirebonese (Basa Cirebon)",
|
||
"Priangan (Basa Priangan)", "Baduy (Basa Baduy)", "Juhut (Basa Juhut)", "Kebonese (Basa Kebon)",
|
||
"Karuhun (Basa Karuhun)", "Sunda Kalapa (Basa Sunda Kalapa)",
|
||
"Sunda Wiwitan (Basa Sunda Wiwitan)", "Sundanese Sign Language (Basa Isyarat Sunda)"],
|
||
'Swahili': ["Standard Swahili (Kiswahili)", "Kiunguja (Zanzibar Swahili)", "Kimvita (Mombasa Swahili)",
|
||
"Kiamu (Lamu Swahili)", "Chaga Swahili (Kiswahili cha Chaga)",
|
||
"Changamwe Swahili (Kiswahili cha Changamwe)", "Kivumba (Pemba Swahili)", "Kipemba (Pemba Swahili)",
|
||
"Kisiu (Pemba Swahili)", "Kiswahili cha Kikamba (Kamba Swahili)",
|
||
"Kiswahili cha Kimtang’ata (Tanga Swahili)", "Kiswahili cha Kibondei (Bondei Swahili)",
|
||
"Kiswahili cha Kiamu (Lamu Swahili)", "Kiswahili cha Kigiryama (Giryama Swahili)",
|
||
"Kiswahili cha Kimikindani (Mikindani Swahili)", "Kiswahili cha Kinyiha (Nyika Swahili)",
|
||
"Kiswahili cha Kinyika (Nyika Swahili)", "Kiswahili cha Kinyaturu (Nyaturu Swahili)",
|
||
"Kiswahili cha Kimaragoli (Maragoli Swahili)", "Kiswahili cha Kimeru (Meru Swahili)",
|
||
"Kiswahili cha Kingoni (Ngazija Swahili)", "Kiswahili cha Kitwabo (Tanzanian Sign Language)",
|
||
"Kiswahili cha Kimeru (Meru Swahili)", "Kiswahili cha Kingoni (Ngazija Swahili)",
|
||
"Kiswahili cha Kijita (Jita Swahili)", "Kiswahili cha Kijita (Jita Swahili)",
|
||
"Kiswahili cha Kimeru (Meru Swahili)", "Kiswahili cha Kitwabo (Tanzanian Sign Language)",
|
||
"Kiswahili cha Kichaga (Chaga Swahili)", "Kiswahili cha Kimijikenda (Mijikenda Swahili)",
|
||
"Kiswahili cha Kimbugu (Mbunga Swahili)", "Kiswahili cha Kimakua (Makua Swahili)",
|
||
"Kiswahili cha Kimijikenda (Mijikenda Swahili)", "Kiswahili cha Kimbugu (Mbunga Swahili)",
|
||
"Kiswahili cha Kimakua (Makua Swahili)", "Kiswahili cha Kimijikenda (Mijikenda Swahili)",
|
||
"Kiswahili cha Kimbugu (Mbunga Swahili)", "Kiswahili cha Kimakua (Makua Swahili)",
|
||
"Kiswahili cha Kimvita (Mombasa Swahili)", "Kiswahili cha Kimijikenda (Mijikenda Swahili)",
|
||
"Kiswahili cha Kimbugu (Mbunga Swahili)", "Kiswahili cha Kimakua (Makua Swahili)",
|
||
"Kiswahili cha Kimvita (Mombasa Swahili)", "Kiswahili cha Kimijikenda (Mijikenda Swahili)",
|
||
"Kiswahili cha Kimbugu (Mbunga Swahili)", "Kiswahili cha Kimakua (Makua Swahili)",
|
||
"Kiswahili cha Kikuria (Kuria Swahili)", "Kiswahili cha Kipokomo (Pokomo Swahili)",
|
||
"Kiswahili cha Kimijikenda (Mijikenda Swahili)", "Kiswahili cha Kimbugu (Mbunga Swahili)",
|
||
"Kiswahili cha Kimakua (Makua Swahili)", "Kiswahili cha Kikuria (Kuria Swahili)",
|
||
"Kiswahili cha Kipokomo (Pokomo Swahili)", "Kiswahili cha Kimijikenda (Mijikenda Swahili)",
|
||
"Kiswahili cha Kimbugu (Mbunga Swahili)", "Kiswahili cha Kimakua (Makua Swahili)",
|
||
"Kiswahili cha Kikuria (Kuria Swahili)", "Kiswahili cha Kipokomo (Pokomo Swahili)",
|
||
"Kiswahili cha Kimijikenda (Mijikenda Swahili)", "Kiswahili cha Kimbugu (Mbunga Swahili)",
|
||
"Kiswahili cha Kimakua (Makua Swahili)", "Kiswahili cha Kikuria (Kuria Swahili)",
|
||
"Kiswahili cha Kipokomo (Pokomo Swahili)", "Kiswahili cha Kimijikenda (Mijikenda Swahili)",
|
||
"Kiswahili cha Kimbugu (Mbunga Swahili)", "Kiswahili cha Kimakua (Makua Swahili)",
|
||
"Kiswahili cha Kipokomo (Pokomo Swahili)", "Kiswahili cha Kimijikenda (Mijikenda Swahili)",
|
||
"Kiswahili cha Kimbugu (Mbunga Swahili)", "Kiswahili cha Kimakua (Makua Swahili)",
|
||
"Kiswahili cha Kimijikenda (Mijikenda Swahili)", "Kiswahili cha Kimbugu (Mbunga Swahili)"],
|
||
'Swedish': ["Standard Swedish (Svenska)", "Southern Swedish (Sydsvenska)", "Eastern Swedish (Östsvenska)",
|
||
"Western Swedish (Västsvenska)", "Northern Swedish (Norrlandssvenska)", "Gotlandic (Gotländska)",
|
||
"Scanian (Skånska)", "Dalecarlian (Dalmål)", "Finnish Swedish (Finlandssvenska)",
|
||
"Gutnish (Gutniska)", "Jamtlandic (Jämtska)", "Kalix (Kalixmål)", "Närpes (Närpesmål)",
|
||
"Pitemål (Pitemål)", "Piteå (Piteåmål)", "South Bothnian (Söderbottniska)",
|
||
"Tornedalian (Meänkieli)", "Westrobothnian (Västerbottniska)", "Yukon Swedish (Jukkasjärvi)",
|
||
"Finnish-Swedish Sign Language (Finlandssvenskt teckenspråk)",
|
||
"Swedish Sign Language (Svenskt teckenspråk)"],
|
||
'Tagalog': ["Standard Tagalog (Wikang Filipino)", "Manila Tagalog (Tagalog ng Maynila)",
|
||
"Batangas Tagalog (Tagalog ng Batangas)", "Laguna Tagalog (Tagalog ng Laguna)",
|
||
"Bulacan Tagalog (Tagalog ng Bulacan)", "Quezon Tagalog (Tagalog ng Quezon)",
|
||
"Marinduque Tagalog (Tagalog ng Marinduque)", "Mindoro Tagalog (Tagalog ng Mindoro)",
|
||
"Tarlac Tagalog (Tagalog ng Tarlac)", "Pampanga Tagalog (Tagalog ng Pampanga)",
|
||
"Central Luzon Tagalog (Katagalugan)", "Bicolano Tagalog (Tagalog ng Bikolano)",
|
||
"Visayan Tagalog (Tagalog ng Bisaya)", "Mindanao Tagalog (Tagalog ng Mindanao)",
|
||
"Filipino Sign Language (FSL)"],
|
||
'Tamil': ["Standard Tamil (தமிழ்)", "Brahmin Tamil (பிராமண தமிழ்)", "Iyengar Tamil (ஐயங்கார் தமிழ்)",
|
||
"Iyer Tamil (அய்யர் தமிழ்)", "Mudaliar Tamil (முதலியார் தமிழ்)", "Chettiar Tamil (செட்டியார் தமிழ்)",
|
||
"Kongu Tamil (கொங்கு தமிழ்)", "Madras Bashai (மெட்ராஸ் பாஷை)",
|
||
"Kanyakumari Tamil (கன்னியாகுமரி தமிழ்)", "Malaysian Tamil (மலேஷிய தமிழ்)",
|
||
"Singaporean Tamil (சிங்கப்பூர் தமிழ்)", "Sri Lankan Tamil (இலங்கை தமிழ்)",
|
||
"Jaffna Tamil (யாழ்ப்பாண தமிழ்)", "Eastern Tamil (கிழக்கு தமிழ்)", "Northern Tamil (வட தமிழ்)",
|
||
"Western Tamil (மேற்கு தமிழ்)", "Central Tamil (மத்திய தமிழ்)", "Hill Country Tamil (மலையார் தமிழ்)",
|
||
"Sri Lankan Creole Tamil (Sri Lankan Pidgin Tamil)", "Reunion Tamil (Réunion Tamil)",
|
||
"Mauritian Tamil (Mauritian Kreol)", "Tamil Sign Language (தமிழ் கை குழு மொழி)"],
|
||
'Tatar': ["Standard Tatar (Татарча)", "Kazan Tatar (Qazan tatar)", "Siberian Tatar (Sibiryak tatar)",
|
||
"Kazakh Tatar (Qazaq tatar)", "Crimean Tatar (Qırımtatar tili)", "Saratov Tatar (Saratov tatar)",
|
||
"Ufa Tatar (Ufa tatar)", "Simbirsk Tatar (Simbirsk tatar)", "Tobol Tatar (Tobol tatar)",
|
||
"Mishar Tatar (Mishar tatar)", "Nizhnekamsk Tatar (Nizhnekamsk tatar)", "Kazan Tatar (Kazan tatar)",
|
||
"Kazan Tatar (Казан татар)"],
|
||
'Telugu': ["Standard Telugu (తెలుగు)", "Andhra Telugu (ఆంధ్ర తెలుగు)", "Rayalaseema Telugu (రాయలసీమ తెలుగు)",
|
||
"Telangana Telugu (తెలంగాణ తెలుగు)", "Coastal Andhra Telugu (తెలుగు తీర ఆంధ్ర)",
|
||
"Krishna Telugu (కృష్ణ తెలుగు)", "Godavari Telugu (గోదావరి తెలుగు)",
|
||
"Guntur Telugu (గుంటూరు తెలుగు)", "Telugu Sign Language (తెలుగు సైన్ భాష)"],
|
||
'Thai': ["Standard Thai (ภาษาไทย)", "Central Thai (ภาษาไทยพูดในเขตกลาง)",
|
||
"Northern Thai (ภาษาไทยพูดในเขตเหนือ)", "Northeastern Thai (ภาษาไทยพูดในเขตอีสาน)",
|
||
"Southern Thai (ภาษาไทยพูดในเขตใต้)", "Phuan Thai (ภาษาไทยพูดในเขตภูเวียง)",
|
||
"Pak Tai (ภาษาไทยพูดในเขตปักษ์ใต้)", "Lao Isan (ภาษาไทยพูดในเขตลาวอีสาน)",
|
||
"Kelantan-Pattani Malay (ภาษาไทยพูดในเขตกลันตัน-ปัตตานี)", "Thai Sign Language (ภาษามือไทย)"],
|
||
'Turkish': ["Standard Turkish (Türkçe)", "Istanbul Turkish (İstanbul Türkçesi)",
|
||
"Anatolian Turkish (Anadolu Türkçesi)", "Aegean Turkish (Ege Türkçesi)",
|
||
"Black Sea Turkish (Karadeniz Türkçesi)", "Mediterranean Turkish (Akdeniz Türkçesi)",
|
||
"Eastern Anatolian Turkish (Doğu Anadolu Türkçesi)",
|
||
"Southeastern Anatolian Turkish (Güneydoğu Anadolu Türkçesi)",
|
||
"Azerbaijani Turkish (Azerbaycan Türkçesi)", "Kazakh Turkish (Kazak Türkçesi)",
|
||
"Kyrgyz Turkish (Kırgız Türkçesi)", "Uzbek Turkish (Özbek Türkçesi)",
|
||
"Turkmen Turkish (Türkmen Türkçesi)", "Uighur Turkish (Uygur Türkçesi)",
|
||
"Tatar Turkish (Tatar Türkçesi)", "Bashkir Turkish (Başkurt Türkçesi)",
|
||
"Chuvash Turkish (Çuvaş Türkçesi)", "Gagauz Turkish (Gagavuzya Türkçesi)",
|
||
"Karachay-Balkar Turkish (Karaçay-Balkar Türkçesi)", "Kumyk Turkish (Kumuk Türkçesi)",
|
||
"Nogai Turkish (Nogay Türkçesi)", "Crimean Turkish (Kırım Türkçesi)", "Tatar Turkish (Tatarca)",
|
||
"Yakut Turkish (Yakutça)", "Karaim Turkish (Karaim Türkçesi)",
|
||
"Karakalpak Turkish (Karakalpakistan Türkçesi)", "Khakas Turkish (Hakasya Türkçesi)",
|
||
"Sakha Turkish (Sahaca)", "Turkish Sign Language (Türk İşaret Dili)"],
|
||
'Turkmen': ["Standard Turkmen (Türkmen dili)", "Yomut Turkmen (Yomut)", "Teke Turkmen (Teke)",
|
||
"Salor Turkmen (Salor)", "Saryk Turkmen (Saryk)", "Nokhur Turkmen (Nokhur)",
|
||
"Ersary Turkmen (Ersary)", "Göklen Turkmen (Göklen)", "Yazgulyam Turkmen (Yazgulyam)",
|
||
"Türkmençe (Turkmen Sign Language)"],
|
||
'Ukranian': ["Standard Ukrainian (Українська)", "Polissian Ukrainian (Поліська українська)",
|
||
"Poltava Ukrainian (Полтавська українська)", "Slobozhan Ukrainian (Слобожанська українська)",
|
||
"Transcarpathian Ukrainian (Закарпатська українська)", "Lemko Ukrainian (Лемківська українська)",
|
||
"Boiko Ukrainian (Бойківська українська)", "Hutsul Ukrainian (Гуцульська українська)",
|
||
"Bukovinian Ukrainian (Буковинська українська)", "Podillian Ukrainian (Подільська українська)",
|
||
"Volhynian Ukrainian (Волинська українська)", "Ruthenian Ukrainian (Русинська українська)",
|
||
"Pannonian Ukrainian (Угорські українці)", "Bessarabian Ukrainian (Буковинська українська)",
|
||
"Halytskyi Ukrainian (Галицька українська)", "Baltic Ukrainian (Балтійська українська)",
|
||
"Zakarpattia Ukrainian (Закарпатська українська)", "Carpathian Ukrainian (Карпатська українська)",
|
||
"Polish Border Ukrainian (Західнополонеська українська)",
|
||
"Siberian Ukrainian (Сибірська українська)", "Ukrainian Sign Language (Українська жестова мова)"],
|
||
'Urdu': ["Standard Urdu (اردو)", "Punjabi-Urdu (پنجابی اردو)", "Sindhi-Urdu (سندھی اردو)",
|
||
"Pothohari-Urdu (پوٹھواری اردو)", "Kashmiri-Urdu (کشمیری اردو)", "Saraiki-Urdu (سرائیکی اردو)",
|
||
"Hindko-Urdu (ہنڈکو اردو)", "Balochi-Urdu (بلوچی اردو)", "Pashto-Urdu (پشتو اردو)",
|
||
"Balti-Urdu (بلتی اردو)", "Dardic-Urdu (دردی اردو)", "Khowar-Urdu (خوار اردو)",
|
||
"Brahui-Urdu (براہوئی اردو)", "Shina-Urdu (شینا اردو)", "Wakhi-Urdu (واخی اردو)",
|
||
"Burushaski-Urdu (بروشسکی اردو)", "Gilgiti-Urdu (گلگتی اردو)", "Wakhi-Urdu (واخی اردو)",
|
||
"Dardic-Urdu (دردی اردو)", "Khowar-Urdu (خوار اردو)", "Brahui-Urdu (براہوئی اردو)",
|
||
"Shina-Urdu (شینا اردو)", "Wakhi-Urdu (واخی اردو)", "Burushaski-Urdu (بروشسکی اردو)",
|
||
"Gilgiti-Urdu (گلگتی اردو)", "Hindustani (हिन्दुस्तानी)", "Deccani (دکنی)", "Awadhi (अवधी)",
|
||
"Braj Bhasha (ब्रज भाषा)", "Haryanvi (हरियाणवी)", "Kumaoni (कुमाऊनी)", "Garhwali (गढ़वळ)",
|
||
"Rohingya-Urdu (Rohingya)", "Indian Sign Language (ISL)", "Pakistani Sign Language (PSL)"],
|
||
'Uyghur': ["Standard Uyghur (ئۇيغۇرچە / Uyghurche)", "Kashgar Uyghur (قەشقەر تىلى / قەشقەرچە)",
|
||
"Hotan Uyghur (خوتەن تىلى / خوتەنچە)", "Ili Uyghur (ئىلى تىلى / ئىلىچە)",
|
||
"Karamay Uyghur (قاراماي تىلى / قارامايچە)", "Turpan Uyghur (تۇرپان تىلى / تۇرپانچە)",
|
||
"Qumul Uyghur (قۇمۇل تىلى / قۇمۇلچە)", "Aksu Uyghur (ئاقسۇ تىلى / ئاقسۇچە)",
|
||
"Yarkant Uyghur (يەركەنت تىلى / يەركەنتچە)", "Aral Uyghur (ئارال تىلى / ئارالچە)",
|
||
"Kucha Uyghur (كۇچار تىلى / كۇچارچە)", "Lopnor Uyghur (لوپنۇر تىلى / لوپنۇرچە)",
|
||
"Altishahr Uyghur (ئالتۇن شەھەر تىلى / ئالتۇن شەھەرچە)",
|
||
"Besh-Toghrak Uyghur (بەشتوغراق تىلى / بەشتوغراقچە)", "Kizilsu Uyghur (قىزىلسۇ تىلى / قىزىلسۇچە)",
|
||
"Kirghiz-Uyghur (قىرغىز تىلى / قىرغىزچە)", "Ili-Kirghiz (ئىلى قىرغىز تىلى / ئىلى قىرغىزچە)",
|
||
"Kumul-Kirghiz (قۇمۇل قىرغىز تىلى / قۇمۇل قىرغىزچە)",
|
||
"Xinjiang Sign Language (新疆手語 / شىنجاڭ قول تىلى)"],
|
||
'Uzbek': ["Standard Uzbek (Oʻzbekcha)", "Northern Uzbek (Oʻzbek tili)", "Southern Uzbek (Janubiy Oʻzbekcha)",
|
||
"Tashkent Uzbek (Toshkent oʻzbek tili)", "Bukhara Uzbek (Buxoro oʻzbek tili)",
|
||
"Samarkand Uzbek (Samarqand oʻzbek tili)", "Khorezm Uzbek (Xorazm oʻzbek tili)",
|
||
"Karakalpak Uzbek (Qoraqalpogʻiston oʻzbek tili)", "Surkhandarya Uzbek (Surxondaryo oʻzbek tili)",
|
||
"Fergana Uzbek (Fargʻona oʻzbek tili)", "Tajik Uzbek (Tojik oʻzbek tili)",
|
||
"Kazakh Uzbek (Qozoq oʻzbek tili)", "Karakalpak Uzbek (Qoraqalpogʻiston oʻzbek tili)",
|
||
"Tatar Uzbek (Toʻrtkoʻl oʻzbek tili)", "Bashkir Uzbek (Başqort oʻzbek tili)",
|
||
"Uighur Uzbek (Uyghur oʻzbek tili)", "Turkmen Uzbek (Turkman oʻzbek tili)",
|
||
"Korean Uzbek (Koreys oʻzbek tili)", "Afghan Uzbek (Afgʻon oʻzbek tili)",
|
||
"Tajik Uzbek (Tojik oʻzbek tili)", "Uzbek Sign Language (Oʻzbek shish toʻqi)"],
|
||
'Vietnamese': ["Standard Vietnamese (Tiếng Việt)", "Northern Vietnamese (Tiếng Bắc)",
|
||
"Southern Vietnamese (Tiếng Nam)", "Central Vietnamese (Tiếng Trung)",
|
||
"Hanoi Vietnamese (Tiếng Hà Nội)", "Saigon Vietnamese (Tiếng Sài Gòn)",
|
||
"Hue Vietnamese (Tiếng Huế)", "Nha Trang Vietnamese (Tiếng Nha Trang)",
|
||
"Haiphong Vietnamese (Tiếng Hải Phòng)", "Quang Ngai Vietnamese (Tiếng Quảng Ngãi)",
|
||
"Can Tho Vietnamese (Tiếng Cần Thơ)", "Hanoi Sign Language (Ngôn ngữ ký hiệu Hà Nội)",
|
||
"Saigon Sign Language (Ngôn ngữ ký hiệu Sài Gòn)"],
|
||
'Welsh': ['Gwynedd', 'Powys', 'Ceredigion', 'Carmarthenshire', 'Pembrokeshire', 'Monmouthshire', 'Denbighshire',
|
||
'Flintshire', 'Anglesey', 'Merthyr Tydfil', 'Rhondda Cynon Taf', 'Swansea', 'Cardiff',
|
||
'Blaenau Gwent', 'Neath Port Talbot'],
|
||
'Xhosa': ['Eastern Xhosa', 'Western Xhosa', 'Mpondo', 'Bhaca', 'Thembu', 'Khonga', 'Gcaleka', 'Mpondomise',
|
||
'Bomvana', 'Xesibe', 'Mfengu'],
|
||
'Yiddish': ['Eastern Yiddish', 'Western Yiddish', 'Southeastern Yiddish', 'Northern Yiddish', 'Central Yiddish',
|
||
'Litvish', 'Galitzish', 'Podolian', 'Ukrainian Yiddish', 'Romanian Yiddish', 'Bessarabian Yiddish',
|
||
'Polish Yiddish', 'Czech Yiddish', 'Hungarian Yiddish', 'Slovak Yiddish', 'Russian Yiddish',
|
||
'Belarusian Yiddish', 'Lithuanian Yiddish', 'Latvian Yiddish', 'Estonian Yiddish',
|
||
'Karelian Yiddish'],
|
||
'Yoruba': ['Èkó', 'Ìbàdàn', 'Ìçáwó', 'Ìçèjè', 'Ìçèríkò', 'Ìgálèndó', 'Ìgbómìnà', 'Ìjèbú', 'Ìkánní', 'Ìlàjà',
|
||
'Ìlárè', 'Ìlésà', 'Ìlorin', 'Ìpèjú', 'Ìpójú', 'Ìrèmò', 'Ìrèwọ̀', 'Ìsábí', 'Ìt’ẹshọwọ', 'Ìwò',
|
||
'Ìyárwò', 'Ìyên'],
|
||
'Zulu': ["Zulu kaMalandela", "Zulu kaNtombela", "Zulu kaMlaba", "Zulu kaMdluli", "Zulu kaMuziwakhe",
|
||
"Zulu kaNgcongolo", "Zulu kaNyanya", "Zulu kaBhekelanga", "Zulu kaNyongoloka", "Zulu kaJama",
|
||
"Zulu kaJacob", "Zulu kaZephania", "Zulu kaLukashiya", "Zulu kaYandisiwe", "Zulu kaPofu",
|
||
"Zulu kaPhuthi", "Zulu kaSiyaya"]
|
||
}
|
||
final_list = list(dialects[str(lang)])
|
||
return JsonResponse({"datadilect": final_list})
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def admin_dashboard(request):
|
||
if request.user.is_superuser:
|
||
tasks = LPPTASKDatabase.objects.all().order_by("-date_at")
|
||
return render(request, "lpp/admin_dashboard.html", {"tasks": tasks})
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def manually_assign_admin(request):
|
||
if request.user.is_superuser:
|
||
task = LPPTASKDatabase.objects.get(task_id=request.POST.get("task_id"))
|
||
if task.status == "actionline_inprogress" or task.status == "actionline_lppassigned" or task.status == "none_available_action":
|
||
eligible_lpp = task.eligiblelpp_action.all()
|
||
else:
|
||
eligible_lpp = task.eligiblelpp_dialogue.all()
|
||
list_lpp = []
|
||
for i in eligible_lpp:
|
||
list_lpp.append([f"{i.first_name} {i.last_name}", i.lpp_id])
|
||
# data = serializers.serialize('json', list_lpp)
|
||
return JsonResponse({"lpp_list": list_lpp})
|
||
|
||
|
||
def manual_assignment(request):
|
||
# task = LPPTASKDatabase.objects.get(task_id = request.POST.get("task_id"))
|
||
# if task.status == "actionline_inprogress" or task.status == "actionline_lppassigned" or task.status == "none_available_action":
|
||
# task.assignedlpp_action = MNFLPPDDatabase.objects.get(lpp_id=request.POST.get("lpp_id"))
|
||
# task.save()
|
||
# else:
|
||
# task.assignedlpp_dialogue = MNFLPPDDatabase.objects.get(lpp_id=request.POST.get("lpp_id"))
|
||
# task.save()
|
||
|
||
manualassign(request, id="")
|
||
|
||
return JsonResponse({"status": "success"})
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def lpptask_dashboard(request):
|
||
# conversion, onepager, trnslate srt, generate srt, ppt
|
||
x = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]
|
||
# x = LPPTASKDatabase.objects.all()
|
||
if MNFLPPDDatabase.objects.filter(user_id=request.user).exists():
|
||
Y = MNFLPPDDatabase.objects.get(user_id=request.user)
|
||
else:
|
||
print("You are not a LPP")
|
||
context = {"data": [], "Data1": []}
|
||
return render(request, "lpp/lpptask_dashboard.html", context)
|
||
# return multilingual_render(request, "lpp/lpptask_dashboard.html", context)
|
||
|
||
num_of_tasks = LPPTASKDatabase.objects.filter(
|
||
Q(assignedlpp_action=Y.lpp_id) | Q(assignedlpp_dialogue=Y.lpp_id)
|
||
).count()
|
||
if num_of_tasks > 0:
|
||
x2 = []
|
||
x1 = LPPTASKDatabase.objects.filter(
|
||
Q(assignedlpp_action=Y.lpp_id) | Q(assignedlpp_dialogue=Y.lpp_id)
|
||
)
|
||
for i in x1:
|
||
if i.status == "actionline_inprogress" or (i.status == "dialogue_inprogress" and i.assignedlpp_action):
|
||
if i.generated_from == "conversion":
|
||
x2.append(i)
|
||
# x1.remove(i)
|
||
x[0][0] = x[0][0] + 1
|
||
# for i in x1:
|
||
# if i.status == "subtitle_vetting_inprogress":
|
||
# if i.translated_subtitle.subtitles_id.target_languages != "":
|
||
# x2.append(i)
|
||
# # x1.remove(i)
|
||
# x[2][0] = x[2][0] + 1
|
||
for i in x1:
|
||
if i.status == "actionline_inprogress" or i.status == "dialogue_inprogress":
|
||
if i.generated_from == "onepager":
|
||
x2.append(i)
|
||
# x1.remove(i)
|
||
x[1][0] = x[1][0] + 1
|
||
# for i in x1:
|
||
# if i.status == "subtitle_vetting_inprogress":
|
||
# if i.translated_subtitle.subtitles_id.target_languages == "":
|
||
# x2.append(i)
|
||
# # x1.remove(i)
|
||
# x[3][0] = x[3][0] + 1
|
||
# ppt - inprogress
|
||
for i in x1:
|
||
if i.status == "dialogue_inprogress" and not i.assignedlpp_action:
|
||
if i.generated_from == "conversion":
|
||
x2.append(i)
|
||
# x1.remove(i)
|
||
x[4][0] = x[4][0] + 1
|
||
|
||
for i in x1:
|
||
if (
|
||
i.status == "actionline_lppassigned"
|
||
or i.status == "dialogue_lppassigned" and i.assignedlpp_action
|
||
):
|
||
if i.generated_from == "conversion":
|
||
if i.status == "dialogue_lppassigned" and i.assignedlpp_action.user_id.email == request.user.email:
|
||
pass
|
||
else:
|
||
x2.append(i)
|
||
x[0][1] = x[0][1] + 1
|
||
# for i in x1:
|
||
# if i.status == "subtitle_lppassigned":
|
||
# if i.translated_subtitle.subtitles_id.target_languages != "":
|
||
# x2.append(i)
|
||
# # x1.remove(i)
|
||
# x[2][1] = x[2][1] + 1
|
||
for i in x1:
|
||
if (
|
||
i.status == "actionline_lppassigned"
|
||
or i.status == "dialogue_lppassigned"
|
||
):
|
||
if i.generated_from == "onepager":
|
||
x2.append(i)
|
||
# x1.remove(i)
|
||
x[1][1] = x[1][1] + 1
|
||
# for i in x1:
|
||
# if i.status == "subtitle_lppassigned":
|
||
# if i.translated_subtitle.subtitles_id.target_languages == "":
|
||
# x2.append(i)
|
||
# # x1.remove(i)
|
||
# x[3][1] = x[3][1] + 1
|
||
|
||
# ppt - lppassigned
|
||
for i in x1:
|
||
if (
|
||
not i.assignedlpp_action
|
||
and i.status == "dialogue_lppassigned"
|
||
):
|
||
if i.generated_from == "conversion":
|
||
x2.append(i)
|
||
# x1.remove(i)
|
||
x[4][1] = x[4][1] + 1
|
||
|
||
for i in x1:
|
||
if (
|
||
i.status == "actionline_completed"
|
||
or i.status == "dialogue_completed"
|
||
or i.status == "completed"
|
||
or i.status == "none_available_dialogue") and i.assignedlpp_action:
|
||
|
||
if i.generated_from == "conversion":
|
||
x2.append(i)
|
||
# x1.remove(i)
|
||
x[0][2] = x[0][2] + 1
|
||
|
||
# Completed Tasks of actionline and assigned to different dialogue lpp case
|
||
# very common case fo different languages getting vetted by different lpps so we need
|
||
# to show actionline lpp after he completed his task
|
||
for i in x1:
|
||
if ((i.status == "dialogue_lppassigned" and i.assignedlpp_action)
|
||
or (i.status == "dialogue_inprogress" and i.assignedlpp_action)) \
|
||
and i.assignedlpp_action.user_id.email == request.user.email:
|
||
if i.generated_from == "conversion":
|
||
if i not in x2:
|
||
x2.append(i)
|
||
# x1.remove(i)
|
||
x[0][2] = x[0][2] + 1
|
||
|
||
# for i in x1:
|
||
# if i.status == "subtitle_completed" or i.status == "completed":
|
||
# try:
|
||
# if i.translated_subtitle:
|
||
# if i.translated_subtitle.subtitles_id.target_languages != "":
|
||
# x2.append(i)
|
||
# # x1.remove(i)
|
||
# x[2][2] = x[2][2] + 1
|
||
# except:
|
||
# pass
|
||
for i in x1:
|
||
if (
|
||
i.status == "actionline_completed"
|
||
or i.status == "dialogue_completed"
|
||
or i.status == "completed"
|
||
or i.status == "none_available_dialogue"
|
||
):
|
||
if i.generated_from == "onepager":
|
||
x2.append(i)
|
||
# x1.remove(i)
|
||
x[1][2] = x[1][2] + 1
|
||
# for i in x1:
|
||
# try:
|
||
# if i.translated_subtitle.subtitles_id.target_languages == "":
|
||
# if i.status == "subtitle_completed" or i.status == "completed":
|
||
#
|
||
# x2.append(i)
|
||
# # x1.remove(i)
|
||
# # x1.remove(i)
|
||
# x[3][2] = x[3][2] + 1
|
||
# except:
|
||
# pass
|
||
|
||
# ppt - completed
|
||
for i in x1:
|
||
if (i.status == "dialogue_completed" or i.status == "completed") and (not i.assignedlpp_action):
|
||
if i.generated_from == "conversion":
|
||
x2.append(i)
|
||
# x1.remove(i)
|
||
x[4][2] = x[4][2] + 1
|
||
|
||
else:
|
||
x2 = []
|
||
print("No task is assigned")
|
||
|
||
|
||
# -> possible tasks
|
||
|
||
possible_tasks = LPPTASKDatabase.objects.filter(
|
||
Q(possiblelpp_action__user_id = request.user) | Q(possiblelpp_dialogue__user_id = request.user)
|
||
)
|
||
print("Possible Taks for this user is:", possible_tasks)
|
||
x3 = []
|
||
if len(possible_tasks) > 0:
|
||
for task in possible_tasks:
|
||
if task.translated_script:
|
||
x3.append(timedelta(days=math.ceil((task.translated_script.script_link_id.numPages) / 15)))
|
||
elif task.translated_ppt:
|
||
x3.append(timedelta(days=math.ceil((task.translated_ppt.slide_count) / 15)))
|
||
# elif task.translated_subtitle:
|
||
# x3.append(timedelta(days=math.ceil((task.translated_subtitle.video_duration)/1800)))
|
||
combined_tasks = zip(possible_tasks, x3)
|
||
context = {"data": x2, "Data1": Y,
|
||
"count": int(num_of_tasks), "counter": x,
|
||
"possible_tasks_no":len(possible_tasks),
|
||
"combined_tasks":combined_tasks}
|
||
|
||
return render(request, "lpp/lpptask_dashboard.html", context)
|
||
# # return multilingual_render(request, "lpp/lpptask_dashboard.html", context)
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def majorTable(request, id, mode):
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=id)
|
||
if mode == "edit":
|
||
country_json_file = open(
|
||
rf"/{basepath}/MNF/json_keys/countries.json")
|
||
data_json = json.load(country_json_file)
|
||
datta_json = []
|
||
for i in data_json:
|
||
datta_json.append([i['name'], i['abbr'].lower()])
|
||
context = {"data": x, "edit": 1, "json_country": datta_json}
|
||
elif mode == "view":
|
||
context = {"data": x, "edit": 0}
|
||
# shehzeen
|
||
context["key"] = settings.COUNTRY_KEY
|
||
return render(request, "lpp/majortable.html", context)
|
||
# return multilingual_render(request, "lpp/majortable.html", context)
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def Table1(request):
|
||
if request.user.is_superuser:
|
||
x = MNFLPPDDatabase.objects.all()
|
||
context = {"data": x}
|
||
return render(request, "lpp/minortable.html", context)
|
||
# return multilingual_render(request, "lpp/minortable.html", context)
|
||
|
||
|
||
|
||
def task_assigner(taskid, source):
|
||
x = LPPTASKDatabase.objects.get(task_id=taskid)
|
||
#Sending Alert to user about his request for vetting
|
||
to = x.user_id.email
|
||
key_value = {
|
||
"User": x.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP1", key_value=key_value)
|
||
|
||
|
||
# Subtitling
|
||
# if source == "subtitling":
|
||
# print("source subtitling 8 june")
|
||
# if x.status == "" or x.status == "none_available_lpp":
|
||
# # Translation of Subtitling
|
||
# if x.translated_subtitle.tar_languages:
|
||
# y = (
|
||
# MNFLPPDDatabase.objects.filter(
|
||
# firstLanguage=str(
|
||
# x.translated_subtitle.tar_languages.language),
|
||
# status="Selected",
|
||
# )
|
||
# .exclude(availabity=False)
|
||
# .order_by("-score")
|
||
# )
|
||
# print(y)
|
||
# if len(y) == 0:
|
||
# print("Trying to find in secondary languages")
|
||
# y = (
|
||
# MNFLPPDDatabase.objects.filter(
|
||
# secondLanguage=str(
|
||
# x.translated_subtitle.tar_languages.language),
|
||
# status="Selected",
|
||
# )
|
||
# .exclude(availabity=False)
|
||
# .order_by("-score")
|
||
# )
|
||
# print("y hai ye june 8", y)
|
||
# if len(y) == 0:
|
||
# x.status = "none_available_lpp"
|
||
# x.save()
|
||
#
|
||
# to = settings.EMAIL_HOST_USER
|
||
# key_value = {
|
||
# "User": "Admin",
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP5", key_value=key_value)
|
||
#
|
||
# # with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# # body = f.read()
|
||
# # context_email = {
|
||
# # "Date": date.today(),
|
||
# # "Name": "Admin",
|
||
# # "emailcode": "LPP101",
|
||
# # "heading1": "Algo is unable to assign LPP",
|
||
# # "heading2": rf"{x.task_id}",
|
||
# # "body": body,
|
||
# # }
|
||
# # # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# # sendemail(
|
||
# # EMAIL_HOST_USER,
|
||
# # "Please manually reassign or Reject",
|
||
# # date.today(),
|
||
# # context_email,
|
||
# # EMAIL_HOST_USER,
|
||
# # ).start()
|
||
# return True
|
||
# count = 0
|
||
# for i in y:
|
||
# if count < 3:
|
||
#
|
||
# x.possiblelpp_dialogue.add(i)
|
||
# # x.date_task_assigned = datetime.now()
|
||
# count += 1
|
||
# # Send mail to assigned LPP
|
||
#
|
||
# to = i.lpp_email
|
||
# key_value = {
|
||
# "User": i.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP3", key_value=key_value)
|
||
#
|
||
# # with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# # body = f.read()
|
||
# # context_email = {
|
||
# # "Date": date.today(),
|
||
# # "Name": x.assignedlpp_dialogue.first_name,
|
||
# # "emailcode": "LPP101",
|
||
# # "heading1": "Get to Work!",
|
||
# # "heading2": "More details you can find on Dashboard",
|
||
# # "body": body,
|
||
# # }
|
||
# # # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# # sendemail(
|
||
# # x.assignedlpp_dialogue.lpp_email,
|
||
# # "A Task has been assigned to you",
|
||
# # date.today(),
|
||
# # context_email,
|
||
# # EMAIL_HOST_USER,
|
||
# # ).start()
|
||
# else:
|
||
# x.eligiblelpp_dialogue.add(i)
|
||
# x.save()
|
||
# # -> Code to determine if Subtitles are generated or translated
|
||
# if x.possiblelpp_dialogue:
|
||
# x.status = "subtitle_lppassigned"
|
||
# # Translated SRT Case
|
||
# if x.translated_subtitle.subtitles_id.target_languages != "":
|
||
# x.usernote = "Kindly check if the translated 'Subtitles' are correct as per the Uploaded Video!"
|
||
# # Genrated SRT Case
|
||
# else:
|
||
# x.usernote = "Kindly check if the Created 'Subtitles' are correct as per the Uploaded Video!"
|
||
# else:
|
||
# x.status = "none_available_lpp"
|
||
# to = settings.EMAIL_HOST_USER
|
||
# key_value = {
|
||
# "User": "Admin",
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP5", key_value=key_value)
|
||
# elif x.status == "subtitle_completed":
|
||
# x.status = "completed"
|
||
# y = MNFLPPDDatabase.objects.get(
|
||
# lpp_id=x.assignedlpp_dialogue.lpp_id)
|
||
# y.no_task_completed += 1
|
||
# y.save()
|
||
# check_promotion(y)
|
||
# x.save()
|
||
# print("Task Assigner Burning")
|
||
#
|
||
# # After Successfully Vetting Creating the Videos using the vetted subtitles
|
||
# # burn subtitles of vetted srt
|
||
# # instance = x.translated_subtitle
|
||
# # x.outputfile = f'{basepath}/media/{x.outputfile}'
|
||
#
|
||
# # Burning new code
|
||
#
|
||
# # video_obj = Videoes.objects.get(
|
||
# # subtitle_video_id=x.translated_subtitle.subtitle_video_id)
|
||
# # video_obj.final_srt = x.outputfile
|
||
# # video_obj.save()
|
||
# # completed(video_obj)
|
||
#
|
||
# lpp = y
|
||
# try:
|
||
# # lpp.lpp_task_balance += Decimal(x.amoutgiventolpp_dialogue)
|
||
# lpp.lpp_task_balance = float(Decimal(
|
||
# str(lpp.lpp_task_balance))) + float(float(Decimal(str(x.amoutgiventolpp_dialogue))) * usd_inr_rate)
|
||
# except Exception as e:
|
||
# print("LPP Balance Error", e)
|
||
# lpp.lpp_task_balance = 0.00 + \
|
||
# float(float(Decimal(x.amoutgiventolpp_dialogue)) * usd_inr_rate)
|
||
# lpp.save()
|
||
#
|
||
# rupees_amount = float(
|
||
# Decimal(x.amoutgiventolpp_dialogue)) * usd_inr_rate
|
||
# # rupees_amount = 505.45
|
||
#
|
||
# try:
|
||
# central_wallet = Wallet.objects.get(user=lpp.user_id)
|
||
# central_wallet.balance = float(
|
||
# central_wallet.balance) + float(rupees_amount)
|
||
# central_wallet.lpp_balance = float(
|
||
# central_wallet.lpp_balance) + float(rupees_amount)
|
||
# central_wallet.save()
|
||
# except Exception as e:
|
||
# print("Error: ", e)
|
||
# central_wallet = Wallet()
|
||
# central_wallet.id = int(Wallet.objects.all().last().id) + 1
|
||
# central_wallet.user = lpp.user_id
|
||
# central_wallet.balance = 0.0 + float(rupees_amount)
|
||
# central_wallet.lpp_balance = 0.0 + float(rupees_amount)
|
||
# central_wallet.save()
|
||
#
|
||
# # Generating Invoice
|
||
# code = str((str(x.translated_subtitle.folder).split("/"))[-2])
|
||
# # doc_fname = (
|
||
# # (str(x.translated_subtitle.upload_ppt).split("/"))[-1]).split(".")[0]
|
||
# x.lpp_invoice_dialogue = f'{code}_Invoice.pdf'
|
||
# x.save()
|
||
# str1 = str(datetime.now()).split("-")
|
||
# # from .utils import render_to_pdf
|
||
# if x.assignedlpp_dialogue.accountno:
|
||
# data = ["0", x.assignedlpp_dialogue.accountno,
|
||
# x.assignedlpp_dialogue.nameofaccount, x.assignedlpp_dialogue.ifsccode]
|
||
# else:
|
||
# data = ["1", x.assignedlpp_dialogue.foreigndetails]
|
||
# context = {
|
||
# "lpp_name": f'{x.assignedlpp_dialogue.first_name} {x.assignedlpp_dialogue.last_name}',
|
||
# "amount": f'{x.amoutgiventolpp_dialogue}',
|
||
# "bank": data,
|
||
# "source_lang": x.translated_subtitle.subtitles_id.src_languages.language,
|
||
# "target_lang": x.translated_subtitle.subtitles_id.target_languages,
|
||
# "source_script": "N/A",
|
||
# "target_script": "N/A",
|
||
# "date_assign": x.date_task_assigned,
|
||
# "duration": (x.completiontime_dialogue - x.lppacceptancetime_dialogue).days,
|
||
# "task_id": x.task_id,
|
||
# "file_name": code,
|
||
# "type_of_work": "Subtitle Vetting",
|
||
# "task_origin": "Subtitling",
|
||
# "date_at": f'{str1[0]} / {str1[1]} / {str1[2][0:2]}',
|
||
# "lpp_country": x.assignedlpp_dialogue.country,
|
||
# "lpp_region": x.assignedlpp_dialogue.province,
|
||
# "lpp_city": x.assignedlpp_dialogue.city,
|
||
# "lpp_contact": x.assignedlpp_dialogue.contact,
|
||
# "invoice_no": str(int(time.time())),
|
||
#
|
||
# }
|
||
# template = get_template(
|
||
# f'{basepath}/lpp/templates/lpp/desktop1.html')
|
||
# html = template.render(context)
|
||
#
|
||
#
|
||
#
|
||
# options = {
|
||
# 'page-size': 'A4',
|
||
# 'margin-top': '0.0in',
|
||
# 'margin-right': '0.0in',
|
||
# 'margin-bottom': '0.0in',
|
||
# 'margin-left': '0.0in',
|
||
# }
|
||
#
|
||
# if domain == "mynextfilm.ai":
|
||
# options["enable-local-file-access"] = ""
|
||
#
|
||
#
|
||
# pdfkit.from_string(
|
||
# html, f'{basepath}/media/lpp_invoice/{code}_Invoice.pdf', options=options)
|
||
#
|
||
#
|
||
# # -> alerting lpp he completed the task
|
||
# to = x.assignedlpp_dialogue.lpp_email
|
||
# key_value = {
|
||
# "User": x.assignedlpp_dialogue.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP12", key_value=key_value)
|
||
#
|
||
# # -> alerting the user he's task his task has been completed
|
||
# to = x.translated_subtitle.user.email
|
||
# key_value = {
|
||
# "User": x.translated_subtitle.user.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP11", key_value=key_value)
|
||
#
|
||
# # if instance.hard:
|
||
# # try:
|
||
# # instance.output_video = hardburn(
|
||
# # instance.src_video.path, instance.project_folder, x.outputfile)
|
||
# # except Exception as e:
|
||
# # print(e, " : Error aa gaya hardburn")
|
||
# # pass
|
||
# # else:
|
||
# # try:
|
||
# # # print("huio", x.outputfile, type(x.outputfile))
|
||
# # if instance.target_lang:
|
||
# # instance.output_video = overlay(instance.src_video.path, instance.project_folder, [
|
||
# # [str(x.outputfile), instance.tar_lang_code]])
|
||
# #
|
||
# # else:
|
||
# # instance.output_video = overlay(instance.src_video.path, instance.project_folder, [
|
||
# # [str(x.outputfile), instance.src_lang_code]])
|
||
# #
|
||
# # except Exception as e:
|
||
# # print(e, " : Error aa gaya overlay")
|
||
# # pass
|
||
# #
|
||
# # instance.vetted_file = x.outputfile
|
||
# # instance.lpp_date = datetime.now()
|
||
# # instance.save()
|
||
# # try:
|
||
# # mail_sender("LPP has generated subtitled video successfully!", instance.user.email, instance.user.first_name, "S100",
|
||
# # "Congratulations! Now you can enjoy your video with subtitles", "Check the subtitled video by clicking on this link: https://mynextfilm.com/subtitle/#/generated")
|
||
# # except:
|
||
# # pass
|
||
#
|
||
# # if len(y) == 0:
|
||
# # x.status = "none_available_dialogue"
|
||
# # x.save()
|
||
# # with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# # body = f.read()
|
||
# # context_email = {
|
||
# # "Date": date.today(),
|
||
# # "Name": "Admin",
|
||
# # "emailcode": "LPP101",
|
||
# # "heading1": "Algo is unable to assign LPP",
|
||
# # "heading2": rf"{x.task_id}",
|
||
# # "body": body,
|
||
# # }
|
||
# # # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# # sendemail(
|
||
# # EMAIL_HOST_USER,
|
||
# # "Please manually reassign or Reject",
|
||
# # date.today(),
|
||
# # context_email,
|
||
# # EMAIL_HOST_USER,
|
||
# # ).start()
|
||
# # return True
|
||
# # count = 0
|
||
# # for i in y:
|
||
# #
|
||
# # if count == 0:
|
||
# # x.assignedlpp_dialogue = i
|
||
# # x.date_task_assigned = datetime.now()
|
||
# # count += 1
|
||
# # # Send mail to assigned LPP
|
||
# # with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# # body = f.read()
|
||
# # context_email = {
|
||
# # "Date": date.today(),
|
||
# # "Name": x.assignedlpp_dialogue.first_name,
|
||
# # "emailcode": "LPP101",
|
||
# # "heading1": "Get to Work!",
|
||
# # "heading2": "More details you can find on Dashboard",
|
||
# # "body": body,
|
||
# # }
|
||
# # # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# # sendemail(
|
||
# # x.assignedlpp_dialogue.lpp_email,
|
||
# # "A Task has been assigned to you",
|
||
# # date.today(),
|
||
# # context_email,
|
||
# # EMAIL_HOST_USER,
|
||
# # ).start()
|
||
# # else:
|
||
# # x.eligiblelpp_dialogue.add(i)
|
||
# # x.save()
|
||
# # if x.assignedlpp_dialogue:
|
||
# # x.status = "subtitle_lppassigned"
|
||
# # x.usernote = "Kindly check if the Created 'Subtitles' are correct as per the Uploaded Video!"
|
||
# # else:
|
||
# # x.status = ""
|
||
|
||
if source == "conversion":
|
||
# translate_srt, conversion, one_pager
|
||
# if the actionline is translated or not
|
||
|
||
if str(x.translated_script.nondial_dest_language) == str(x.translated_script.dial_dest_language) and str(x.translated_script.script_link_id.nondial_src_language) == str(x.translated_script.script_link_id.dial_src_language):
|
||
if x.status == "":
|
||
if (x.translated_script.nondial_dest_language != x.translated_script.script_link_id.nondial_src_language):
|
||
lo = 1
|
||
# actionline lang is different
|
||
if (x.translated_script.dial_dest_language != x.translated_script.script_link_id.dial_src_language):
|
||
mo = 1
|
||
|
||
y = (
|
||
MNFLPPDDatabase.objects.filter(
|
||
firstLanguage=languages[
|
||
str(x.translated_script.script_link_id.nondial_src_language)
|
||
],
|
||
secondLanguage=languages[
|
||
str(x.translated_script.nondial_dest_language)
|
||
],
|
||
status="Selected",
|
||
)
|
||
.exclude(availabity=False)
|
||
.order_by("-score")
|
||
)
|
||
|
||
# scripts should be an deciding for eligible LPPs
|
||
if len(y) == 0:
|
||
x.status = "none_available_action"
|
||
x.save()
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": "Admin",
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Algo is unable to assign LPP",
|
||
# "heading2": rf"{x.task_id}",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# EMAIL_HOST_USER,
|
||
# "Please manually reassign or Reject",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
|
||
to = settings.EMAIL_HOST_USER
|
||
key_value = {
|
||
"User": "Admin",
|
||
"Stage":"(Actionlines and Dialogues)"
|
||
}
|
||
sendmail(to_email=[to], email_code="PP4", key_value=key_value)
|
||
|
||
return True
|
||
count = 0
|
||
for i in y:
|
||
if x.translated_script.script_link_id.nondial_src_script in i.scripts and x.translated_script.dial_dest_script in i.scripts:
|
||
|
||
if count < 3:
|
||
x.possiblelpp_action.add(i)
|
||
# x.date_task_assigned = datetime.now()
|
||
count += 1
|
||
|
||
# Send mail to assigned LPP
|
||
to = i.lpp_email
|
||
key_value = {
|
||
"User": i.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
|
||
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": x.assignedlpp_action.first_name,
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Get to Work!",
|
||
# "heading2": "More details you can find on Dashboard",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# x.assignedlpp_action.lpp_email,
|
||
# "A Task has been assigned to you",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
else:
|
||
x.eligiblelpp_action.add(i)
|
||
x.status = "actionline_lppassigned"
|
||
x.usernote = "Kindly check if the translated 'ACTION LINES' and 'DIALOGUE LINES' are correct as per the Uploaded Document!"
|
||
pass
|
||
|
||
else:
|
||
if x.status == "":
|
||
|
||
if (
|
||
x.translated_script.nondial_dest_language
|
||
!= x.translated_script.script_link_id.nondial_src_language
|
||
): # actionline lang is different
|
||
|
||
y = (
|
||
MNFLPPDDatabase.objects.filter(
|
||
firstLanguage=languages[
|
||
str(x.translated_script.script_link_id.nondial_src_language)
|
||
],
|
||
secondLanguage=languages[
|
||
str(x.translated_script.nondial_dest_language)
|
||
],
|
||
status="Selected",
|
||
)
|
||
.exclude(availabity=False)
|
||
.order_by("-score")
|
||
)
|
||
|
||
# scripts should be a deciding factor for eligible LPPs
|
||
if len(y) == 0:
|
||
x.status = "none_available_action"
|
||
x.save()
|
||
|
||
to = settings.EMAIL_HOST_USER
|
||
key_value = {
|
||
"User": "Admin",
|
||
"Stage": "(Actionlines)"
|
||
}
|
||
sendmail(to_email=[to], email_code="PP4", key_value=key_value)
|
||
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": "Admin",
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Algo is unable to assign LPP",
|
||
# "heading2": rf"{x.task_id}",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# EMAIL_HOST_USER,
|
||
# "Please manually reassign or Reject",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
return True
|
||
|
||
count = 0
|
||
|
||
for i in y:
|
||
|
||
if x.translated_script.script_link_id.nondial_src_script in i.scripts:
|
||
|
||
if count < 3:
|
||
x.possiblelpp_action.add(i)
|
||
# x.date_task_assigned = datetime.now()
|
||
|
||
count += 1
|
||
|
||
# Send mail to assigned LPP
|
||
to = i.lpp_email
|
||
key_value = {
|
||
"User": i.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": x.assignedlpp_action.first_name,
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Get to Work!",
|
||
# "heading2": "More details you can find on Dashboard",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# x.assignedlpp_action.lpp_email,
|
||
# "A Task has been assigned to you",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
else:
|
||
x.eligiblelpp_action.add(i)
|
||
print(x.assignedlpp_action)
|
||
print(x.eligiblelpp_action)
|
||
x.status = "actionline_lppassigned"
|
||
x.usernote = "Kindly check if the translated 'ACTION LINES' are correct as per the Uploaded Document!"
|
||
else:
|
||
x.status = "actionline_completed"
|
||
|
||
if x.status == "actionline_completed":
|
||
if (
|
||
x.translated_script.dial_dest_language
|
||
!= x.translated_script.script_link_id.dial_src_language
|
||
): # actionline lang is different
|
||
y = (
|
||
MNFLPPDDatabase.objects.filter(
|
||
firstLanguage=languages[
|
||
str(x.translated_script.script_link_id.dial_src_language)
|
||
],
|
||
secondLanguage=languages[
|
||
str(x.translated_script.dial_dest_language)
|
||
],
|
||
status="Selected",
|
||
)
|
||
.exclude(availabity=False)
|
||
.order_by("-score")
|
||
) # scripts should be an deciding for eligible LPPs
|
||
if len(y) == 0:
|
||
x.status = "none_available_dialogue"
|
||
x.save()
|
||
|
||
to = settings.EMAIL_HOST_USER
|
||
key_value = {
|
||
"User": "Admin",
|
||
"Stage":"(Dialogues)"
|
||
}
|
||
sendmail(to_email=[to], email_code="PP4", key_value=key_value)
|
||
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": "Admin",
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Algo is unable to assign LPP",
|
||
# "heading2": rf"{x.task_id}",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# EMAIL_HOST_USER,
|
||
# "Please manually reassign or Reject",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
return True
|
||
count = 0
|
||
for i in y:
|
||
if (
|
||
x.translated_script.script_link_id.dial_src_script in i.scripts
|
||
and x.translated_script.dial_dest_script in i.scripts
|
||
):
|
||
if count < 3:
|
||
x.possiblelpp_dialogue.add(i)
|
||
# x.date_task_assigned = datetime.now()
|
||
count += 1
|
||
# Send mail to assigned LPP
|
||
|
||
to = i.lpp_email
|
||
key_value = {
|
||
"User": i.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": x.assignedlpp_dialogue.first_name,
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Get to Work!",
|
||
# "heading2": "More details you can find on Dashboard",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# x.assignedlpp_dialogue.lpp_email,
|
||
# "A Task has been assigned to you",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
else:
|
||
x.eligiblelpp_dialogue.add(i)
|
||
x.status = "dialogue_lppassigned"
|
||
x.usernote = "Kindly check if the translated 'DIALOGUES' are correct as per the Uploaded Document!"
|
||
else:
|
||
x.status = "dialogue_completed"
|
||
|
||
if x.status == "dialogue_completed":
|
||
x.status = "completed"
|
||
try:
|
||
y = MNFLPPDDatabase.objects.get(
|
||
lpp_id=x.assignedlpp_dialogue.lpp_id)
|
||
y.no_task_completed += 1
|
||
y.save()
|
||
check_promotion(y)
|
||
except:
|
||
pass
|
||
x.save()
|
||
convert_to_pdf(str(basepath) + "/media/" + str(x.outputfile),
|
||
str(basepath) + "/media/" + "lpptaskfolder")
|
||
pathspecific = ""
|
||
for i in (str(x.outputfile).split('.'))[:-1]:
|
||
pathspecific = pathspecific + "." + str(i)
|
||
saveFile = pathspecific[1:] + ".pdf"
|
||
x.outputfile.name = saveFile
|
||
x.save()
|
||
|
||
try:
|
||
temp1 = str(x.translated_script.script_link_id.script_title)
|
||
temp2 = str(x.outputfile)
|
||
uploaded_script = f"{basepath}/media/{temp1}"
|
||
translated_script = f"{basepath}/media/{temp2}"
|
||
|
||
data = [uploaded_script, translated_script]
|
||
print("Function 11")
|
||
files, timestamp = upload_multiFile_to_ipfs(
|
||
data, str(x.translated_script.script_link_id.script_title).split("/")[-1], "convertScript", x.translated_script.user_id.email)
|
||
x.translated_script.timestamp = timestamp
|
||
x.translated_script.uploaded_script_encoded = files[0]
|
||
x.translated_script.translated_script_encoded = files[1]
|
||
x.save()
|
||
|
||
# blockchain here
|
||
if UserCredentialsForBlockchain.objects.filter(user_id=x.user_id).exists():
|
||
print("condition>>>>>>>>>>>>>>>>>>condition run")
|
||
blockchain_obj = UserCredentialsForBlockchain.objects.get(user_id=x.user_id)
|
||
privatekey = blockchain_obj.privateKey
|
||
print(privatekey)
|
||
# user_id =blockchain_obj.user_id
|
||
# Project = x.translated_ppt.ppt_id
|
||
# private_Key = decryptionOfPrivate(privatekey)
|
||
# status,getData = getPPTConversion(private_Key.decode('utf-8'),user_id,str(Project))
|
||
# if status == True:
|
||
# data1 = getData[1]
|
||
# pptconversion1 = eval(data1)
|
||
# temp2 = str(x.outputfile)
|
||
# translated_ppt = f"{basepath}/media/{temp2}"
|
||
# with open(translated_ppt, 'rb') as _file:
|
||
# hash = uploadDataToIPFSNode(_file)
|
||
# pptconversion1["vetted_file_hash"] = hash
|
||
# pptconversion1["vetted_file_path"] = translated_ppt
|
||
# pptconversion1["vetted_file"] = temp2
|
||
# Data = str(pptconversion1)
|
||
# response=UploadPPTConversionData(private_Key.decode('utf-8'),user_id, str(Project),Data)
|
||
# print("Response_final :",response)
|
||
except:
|
||
pass
|
||
|
||
# -> Generating Invoice
|
||
# invoice_values = {
|
||
# "pdf_name": f'{((str(x.translated_script.script).split("/"))[-1]).split(".")[0]}_Invoice.pdf',
|
||
# "lpp_name": f'{x.assignedlpp_action.first_name} {x.assignedlpp_action.last_name}',
|
||
# "lpp_contact": x.assignedlpp_action.contact,
|
||
# "source_lang": x.translated_script.dial_src_language,
|
||
# "target_lang": x.translated_script.dial_dest_language,
|
||
# "source_script": x.translated_script.dial_src_script,
|
||
# "target_script": x.translated_script.dial_dest_script,
|
||
# "date_of_assign": x.date_task_assigned,
|
||
# "duration": duration,
|
||
# "task_id": x.task_id,
|
||
# "file_name": x.translated_script.script_title,
|
||
# "type_of_work": "Only Dialogues Script Vetting",
|
||
# "task_origin": "Conversion",
|
||
# "amount": amount,
|
||
#
|
||
# }
|
||
#
|
||
#
|
||
# Invoice = Invoice_Generator(invoice_values)
|
||
# Invoice.generate_invoice()
|
||
if x.assignedlpp_dialogue:
|
||
|
||
# create a docx
|
||
# doc = docx.Document()
|
||
#
|
||
# #add to docx
|
||
# slug_data = doc.add_paragraph()
|
||
# slug_data_format = slug_data.paragraph_format
|
||
# slug_data_format.space_after = Pt(12)
|
||
# slug_data_format.keep_with_next = True
|
||
# slug_data_format.left_indent = Inches(0)
|
||
# slug_data.style.font.name = 'Courier New'
|
||
# slug_data.style.font.size = Pt(12.0)
|
||
# slug_data.add_run("Your LPP Task Amount: ").bold = True
|
||
#
|
||
#
|
||
# slug_data = doc.add_paragraph()
|
||
# slug_data_format = slug_data.paragraph_format
|
||
# slug_data_format.space_after = Pt(12)
|
||
# slug_data_format.keep_with_next = True
|
||
# slug_data_format.left_indent = Inches(0)
|
||
# slug_data.style.font.name = 'Courier New'
|
||
# slug_data.style.font.size = Pt(12.0)
|
||
# task_amount = str(x.amoutgiventolpp_dialogue)
|
||
# slug_data.add_run("$ " + task_amount).bold = False
|
||
|
||
# doc_fname = ((str(x.translated_script.script_file_path).split("/"))[-1]).split(".")[0]
|
||
|
||
# doc_name = f"{basepath}/media/lpp_invoice/{doc_fname}_Invoice.docx"
|
||
# doc.save(doc_name)
|
||
# pdf_name = f"{doc_fname}_Invoice.pdf"
|
||
# convert_to_pdf(doc_name, f"{basepath}/media/lpp_invoice/")
|
||
# x.lpp_invoice_dialogue = pdf_name
|
||
# x.save()
|
||
doc_fname = (
|
||
(str(x.translated_script.translation_id).split("/"))[-1]).split(".")[0]
|
||
x.lpp_invoice_dialogue = f'{doc_fname}_Invoice.pdf'
|
||
x.save()
|
||
str1 = str(datetime.now()).split("-")
|
||
|
||
# adding the amount in lpp wallet
|
||
lpp = MNFLPPDDatabase.objects.get(
|
||
lpp_id=x.assignedlpp_dialogue.lpp_id)
|
||
try:
|
||
# lpp.lpp_task_balance += Decimal(
|
||
# x.amoutgiventolpp_dialogue)
|
||
lpp.lpp_task_balance = float(Decimal(
|
||
str(lpp.lpp_task_balance))) + float(float(Decimal(str(x.amoutgiventolpp_dialogue))) * usd_inr_rate)
|
||
except Exception as e:
|
||
print("LPP Balance Error", e)
|
||
lpp.lpp_task_balance = 0.00 + \
|
||
float(
|
||
float(Decimal(x.amoutgiventolpp_dialogue)) * usd_inr_rate)
|
||
lpp.save()
|
||
|
||
# -> Adding balance to Central Wallet
|
||
rupees_amount = float(
|
||
Decimal(x.amoutgiventolpp_dialogue)) * usd_inr_rate
|
||
|
||
try:
|
||
central_wallet = Wallet.objects.get(user=lpp.user_id)
|
||
central_wallet.balance = float(
|
||
central_wallet.balance) + float(rupees_amount)
|
||
central_wallet.lpp_balance = float(
|
||
central_wallet.lpp_balance) + float(rupees_amount)
|
||
central_wallet.save()
|
||
except Exception as e:
|
||
print("Error: ", e)
|
||
central_wallet = Wallet()
|
||
central_wallet.id = int(
|
||
Wallet.objects.all().last().id) + 1
|
||
central_wallet.user = lpp.user_id
|
||
central_wallet.balance = 0.0 + float(rupees_amount)
|
||
central_wallet.lpp_balance = 0.0 + float(rupees_amount)
|
||
central_wallet.save()
|
||
|
||
# from .utils import render_to_pdf
|
||
if x.assignedlpp_dialogue.accountno:
|
||
data = ["0", x.assignedlpp_dialogue.accountno, x.assignedlpp_dialogue.nameofaccount,
|
||
x.assignedlpp_dialogue.ifsccode]
|
||
else:
|
||
data = ["1", x.assignedlpp_dialogue.foreigndetails]
|
||
context = {
|
||
"lpp_name": f'{x.assignedlpp_dialogue.first_name} {x.assignedlpp_dialogue.last_name}',
|
||
"amount": f'{x.amoutgiventolpp_dialogue}',
|
||
"bank": data,
|
||
"source_lang": x.translated_script.script_link_id.dial_src_language,
|
||
"target_lang": x.translated_script.dial_dest_language,
|
||
"source_script": x.translated_script.script_link_id.dial_src_script,
|
||
"target_script": x.translated_script.dial_dest_script,
|
||
"date_assign": x.date_task_assigned,
|
||
"duration": (x.completiontime_dialogue - x.lppacceptancetime_dialogue).days,
|
||
"task_id": x.task_id,
|
||
"file_name": x.translated_script.script_link_id.script_title,
|
||
"type_of_work": "Only Dialogues Script Vetting",
|
||
"task_origin": "Conversion",
|
||
"date_at": f'{str1[0]} / {str1[1]} / {str1[2][0:2]}',
|
||
"lpp_country": x.assignedlpp_dialogue.country,
|
||
"lpp_region": x.assignedlpp_dialogue.province,
|
||
"lpp_city": x.assignedlpp_dialogue.city,
|
||
"lpp_contact": x.assignedlpp_dialogue.contact,
|
||
"invoice_no": str(int(time.time())),
|
||
"basepath": str(basepath),
|
||
|
||
}
|
||
template = get_template(
|
||
f'{basepath}/lpp/templates/lpp/desktop1.html')
|
||
html = template.render(context)
|
||
options = {
|
||
'page-size': 'A4',
|
||
'margin-top': '0.0in',
|
||
'margin-right': '0.0in',
|
||
'margin-bottom': '0.0in',
|
||
'margin-left': '0.0in',
|
||
}
|
||
if domain == "mynextfilm.ai":
|
||
options["enable-local-file-access"] = ""
|
||
elif domain == "1.6.141.104":
|
||
options["enable-local-file-access"] = ""
|
||
if not os.path.exists(f'{basepath}/media/lpp_invoice'):
|
||
os.makedirs(f'{basepath}/media/lpp_invoice', mode=0o777)
|
||
pdfkit.from_string(
|
||
html, f'{basepath}/media/lpp_invoice/{doc_fname}_Invoice.pdf', options=options, verbose=True)
|
||
|
||
|
||
# subject = "A task has been assigned to you!"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
|
||
# to = x.assignedlpp.lpp_email
|
||
|
||
# context = {"Date": date.today(), "Name": x.assignedlpp.user_id.first_name}
|
||
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/ideamall/templates/ideamall/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
|
||
# print("5777777777777777777777777777777777777777777777777777777777777777777")
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
# elif source == "conversion_ppt":
|
||
#
|
||
# if x.status == "" or x.status == "dialogue_inprogress" or x.status == "dialogue_lppassigned" or x.status == "none_available_dialogue":
|
||
# if (x.translated_ppt.target_lang
|
||
# != x.translated_ppt.source_lang
|
||
# ):
|
||
# y = (
|
||
# MNFLPPDDatabase.objects.filter(
|
||
# firstLanguage=str(x.translated_ppt.source_lang),
|
||
# secondLanguage=str(x.translated_ppt.target_lang),
|
||
# status="Selected",
|
||
# )
|
||
# .exclude(availabity=False)
|
||
# .order_by("-score")
|
||
# ) # scripts should be an deciding for eligible LPPs
|
||
# print("999LPPS avaialble are - ", y)
|
||
# if len(y) == 0:
|
||
# x.status = "none_available_dialogue"
|
||
# x.save()
|
||
# # with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# # body = f.read()
|
||
# # context_email = {
|
||
# # "Date": date.today(),
|
||
# # "Name": "Admin",
|
||
# # "emailcode": "LPP101",
|
||
# # "heading1": "Algo is unable to assign LPP",
|
||
# # "heading2": rf"{x.task_id}",
|
||
# # "body": body,
|
||
# # }
|
||
# # # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# # sendemail(
|
||
# # EMAIL_HOST_USER,
|
||
# # "Please manually reassign or Reject",
|
||
# # date.today(),
|
||
# # context_email,
|
||
# # EMAIL_HOST_USER,
|
||
# # ).start()
|
||
#
|
||
# # -> alerting lpp admin to manually assign
|
||
# to = settings.EMAIL_HOST_USER
|
||
# key_value = {
|
||
# "User": "Admin",
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP5", key_value=key_value)
|
||
# return True
|
||
# count = 0
|
||
# for i in y:
|
||
# if (x.translated_ppt.source_script in i.scripts
|
||
# and x.translated_ppt.target_script in i.scripts):
|
||
# if count < 3:
|
||
# x.possiblelpp_dialogue.add(i)
|
||
# # x.date_task_assigned = datetime.now()
|
||
# count += 1
|
||
#
|
||
#
|
||
# # Send mail to assigned LPP
|
||
# to = i.lpp_email
|
||
# key_value = {
|
||
# "User": i.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP3", key_value=key_value)
|
||
#
|
||
# # with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# # body = f.read()
|
||
# # context_email = {
|
||
# # "Date": date.today(),
|
||
# # "Name": x.assignedlpp_dialogue.first_name,
|
||
# # "emailcode": "LPP101",
|
||
# # "heading1": "Get to Work!",
|
||
# # "heading2": "More details you can find on Dashboard",
|
||
# # "body": body,
|
||
# # }
|
||
# # # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# # sendemail(
|
||
# # x.assignedlpp_dialogue.lpp_email,
|
||
# # "A Task has been assigned to you",
|
||
# # date.today(),
|
||
# # context_email,
|
||
# # EMAIL_HOST_USER,
|
||
# # ).start()
|
||
# else:
|
||
# x.eligiblelpp_dialogue.add(i)
|
||
# x.save()
|
||
# if x.assignedlpp_dialogue:
|
||
# x.status = "dialogue_lppassigned"
|
||
# x.usernote = "Kindly check if the translated 'Text' are correct as per the Uploaded PPT!"
|
||
# else:
|
||
# x.status = "none_available_dialogue"
|
||
# # Send mail to assigned LPP
|
||
# to = settings.EMAIL_HOST_USER
|
||
# key_value = {
|
||
# "User": "Admin",
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP5", key_value=key_value)
|
||
#
|
||
# else:
|
||
# x.status = "dialogue_completed"
|
||
#
|
||
# if x.status == "dialogue_completed":
|
||
# x.status = "completed"
|
||
# y = MNFLPPDDatabase.objects.get(
|
||
# lpp_id=x.assignedlpp_dialogue.lpp_id)
|
||
# y.no_task_completed += 1
|
||
# y.save()
|
||
# check_promotion(y)
|
||
# x.save()
|
||
# if pptconversion.objects.filter(ppt_id=x.translated_ppt.ppt_id):
|
||
# obj = pptconversion.objects.get(ppt_id=x.translated_ppt.ppt_id)
|
||
# obj.vetted_file = str(x.outputfile)
|
||
# try:
|
||
# # blockchain here
|
||
# if UserCredentialsForBlockchain.objects.filter(user_id=obj.user_id_id).exists():
|
||
# blockchain_obj = UserCredentialsForBlockchain.objects.get(user_id=obj.user_id_id)
|
||
# privatekey = blockchain_obj.privateKey
|
||
# user_id =blockchain_obj.user_id
|
||
# Project = x.translated_ppt.ppt_id
|
||
# private_Key = decryptionOfPrivate(privatekey)
|
||
# status,getData = getPPTConversion(private_Key.decode('utf-8'),user_id,str(Project))
|
||
# if status == True:
|
||
# data1 = getData[1]
|
||
# pptconversion1 = eval(data1)
|
||
# temp2 = str(x.outputfile)
|
||
# translated_ppt = f"{basepath}/media/{temp2}"
|
||
# with open(translated_ppt, 'rb') as _file:
|
||
# hash = uploadDataToIPFSNode(_file)
|
||
# pptconversion1["vetted_file_hash"] = hash
|
||
# pptconversion1["vetted_file_path"] = translated_ppt
|
||
# pptconversion1["vetted_file"] = temp2
|
||
# Data = str(pptconversion1)
|
||
# response=UploadPPTConversionData(OWNER_KEY,blockchain_obj.publicKey,user_id, str(Project),Data)
|
||
# print("Response_final :",response)
|
||
#
|
||
#
|
||
# # temp1 = str(obj.upload_ppt)
|
||
# # temp2 = str(x.outputfile)
|
||
# # uploaded_ppt = f"{basepath}/media/{temp1}"
|
||
# # translated_ppt = f"{basepath}/media/{temp2}"
|
||
# #
|
||
# # data = [uploaded_ppt, translated_ppt]
|
||
# # files, timestamp = upload_multiFile_to_ipfs(
|
||
# # data, obj.ppt_string, "convertPPT", obj.user_id.email)
|
||
# # obj.timestamp = timestamp
|
||
# # obj.uploaded_ppt_encoded = files[0]
|
||
# # obj.translated_ppt_encoded = files[1]
|
||
# obj.save()
|
||
# except:
|
||
# pass
|
||
#
|
||
# lpp = MNFLPPDDatabase.objects.get(
|
||
# lpp_id=x.assignedlpp_dialogue.lpp_id)
|
||
# try:
|
||
# # lpp.lpp_task_balance += Decimal(x.amoutgiventolpp_dialogue)
|
||
# lpp.lpp_task_balance = float(Decimal(
|
||
# str(lpp.lpp_task_balance))) + float(float(Decimal(str(x.amoutgiventolpp_dialogue))) * usd_inr_rate)
|
||
# except Exception as e:
|
||
# print("LPP Balance Error", e)
|
||
# lpp.lpp_task_balance = 0.00 + \
|
||
# float(float(Decimal(x.amoutgiventolpp_dialogue)) * usd_inr_rate)
|
||
# lpp.save()
|
||
#
|
||
# rupees_amount = float(
|
||
# Decimal(x.amoutgiventolpp_dialogue)) * usd_inr_rate
|
||
# # rupees_amount = 505.45
|
||
#
|
||
# try:
|
||
# central_wallet = Wallet.objects.get(user=lpp.user_id)
|
||
# central_wallet.balance = float(
|
||
# central_wallet.balance) + float(rupees_amount)
|
||
# central_wallet.lpp_balance = float(
|
||
# central_wallet.lpp_balance) + float(rupees_amount)
|
||
# central_wallet.save()
|
||
# except Exception as e:
|
||
# print("Error: ", e)
|
||
# central_wallet = Wallet()
|
||
# central_wallet.id = int(Wallet.objects.all().last().id) + 1
|
||
# central_wallet.user = lpp.user_id
|
||
# central_wallet.balance = 0.0 + float(rupees_amount)
|
||
# central_wallet.lpp_balance = 0.0 + float(rupees_amount)
|
||
# central_wallet.save()
|
||
#
|
||
# # Generating Invoice
|
||
# doc_fname = (
|
||
# (str(x.translated_ppt.upload_ppt).split("/"))[-1]).split(".")[0]
|
||
# x.lpp_invoice_dialogue = f'{doc_fname}_Invoice.pdf'
|
||
# x.save()
|
||
# str1 = str(datetime.now()).split("-")
|
||
# # from .utils import render_to_pdf
|
||
# if x.assignedlpp_dialogue.accountno:
|
||
# data = ["0", x.assignedlpp_dialogue.accountno,
|
||
# x.assignedlpp_dialogue.nameofaccount, x.assignedlpp_dialogue.ifsccode]
|
||
# else:
|
||
# data = ["1", x.assignedlpp_dialogue.foreigndetails]
|
||
# context = {
|
||
# "lpp_name": f'{x.assignedlpp_dialogue.first_name} {x.assignedlpp_dialogue.last_name}',
|
||
# "amount": f'{x.amoutgiventolpp_dialogue}',
|
||
# "bank": data,
|
||
# "source_lang": x.translated_ppt.source_lang,
|
||
# "target_lang": x.translated_ppt.target_lang,
|
||
# "source_script": x.translated_ppt.source_script,
|
||
# "target_script": x.translated_ppt.target_script,
|
||
# "date_assign": x.date_task_assigned,
|
||
# "duration": (x.completiontime_dialogue - x.lppacceptancetime_dialogue).days,
|
||
# "task_id": x.task_id,
|
||
# "file_name": x.translated_ppt.ppt_string,
|
||
# "type_of_work": "Whole PPT Vetting",
|
||
# "task_origin": "Conversion",
|
||
# "date_at": f'{str1[0]} / {str1[1]} / {str1[2][0:2]}',
|
||
# "lpp_country": x.assignedlpp_dialogue.country,
|
||
# "lpp_region": x.assignedlpp_dialogue.province,
|
||
# "lpp_city": x.assignedlpp_dialogue.city,
|
||
# "lpp_contact": x.assignedlpp_dialogue.contact,
|
||
# "invoice_no": str(int(time.time())),
|
||
#
|
||
# }
|
||
# template = get_template(
|
||
# f'{basepath}/lpp/templates/lpp/desktop1.html')
|
||
# html = template.render(context)
|
||
# options = {
|
||
# 'page-size': 'A4',
|
||
# 'margin-top': '0.0in',
|
||
# 'margin-right': '0.0in',
|
||
# 'margin-bottom': '0.0in',
|
||
# 'margin-left': '0.0in',
|
||
# }
|
||
# if domain == "mynextfilm.ai":
|
||
# options["enable-local-file-access"] = ""
|
||
# pdfkit.from_string(
|
||
# html, f'{basepath}/media/lpp_invoice/{doc_fname}_Invoice.pdf', options=options)
|
||
#
|
||
# # -> alerting lpp he completed the task
|
||
# to = x.assignedlpp_dialogue.lpp_email
|
||
# key_value = {
|
||
# "User": x.assignedlpp_dialogue.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP12", key_value=key_value)
|
||
#
|
||
# # -> alerting the user he's task his task has been completed
|
||
# if x.translated_ppt:
|
||
# to = x.translated_ppt.user_id.email
|
||
# key_value = {
|
||
# "User": x.translated_ppt.user_id.username,
|
||
# }
|
||
# # else:
|
||
# # to = x.translated_subtitle.user.email
|
||
# # key_value = {
|
||
# # "User": x.translated_subtitle.user.username,
|
||
# # }
|
||
# sendmail(to_email=[to], email_code="PP11", key_value=key_value)
|
||
|
||
else:
|
||
pass
|
||
|
||
x.save()
|
||
return True
|
||
# send mail to LPP that a task is assigned
|
||
|
||
|
||
|
||
def reassign_task(taskid, forwhichlines, fromeleigible):
|
||
x = LPPTASKDatabase.objects.get(task_id=taskid)
|
||
# x.ratingonmachinetranslation = 0
|
||
# x.mistakeperpage = ""
|
||
# x.lppacceptancetime = None
|
||
# x.completiontime = None
|
||
# x.deadlinetolpp = None
|
||
check_if_possible_empty(x, None)
|
||
|
||
|
||
if forwhichlines == "action":
|
||
x.ratingonmachinetranslation_action = 0
|
||
x.mistakeperpage_action = ""
|
||
x.lppacceptancetime_action = None
|
||
x.completiontime_action = None
|
||
x.deadlinetolpp_action = None
|
||
|
||
if str(x.translated_script.nondial_dest_language) == str(x.translated_script.dial_dest_language) and str(
|
||
x.translated_script.script_link_id.nondial_src_language) == str(x.translated_script.script_link_id.dial_src_language):
|
||
if fromeleigible == "eligible":
|
||
for i in list(x.eligiblelpp_action.all()):
|
||
|
||
if i.availabity == True:
|
||
# x.assignedlpp_action.remove()
|
||
x.assignedlpp_action = i
|
||
x.date_task_assigned = datetime.now()
|
||
x.eligiblelpp_action.remove(i)
|
||
x.status = "actionline_lppassigned"
|
||
x.save()
|
||
# Send mail to assigned LPP
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": x.assignedlpp_action.first_name,
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Get to Work!",
|
||
# "heading2": "More details you can find on Dashboard",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# x.assignedlpp_action.lpp_email,
|
||
# "A Task has been assigned to you",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
|
||
# -> alerting lpp of assigned task
|
||
to = x.assignedlpp_action.lpp_email
|
||
key_value = {
|
||
"User": x.assignedlpp_action.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
return True
|
||
|
||
# print("line 789---------")
|
||
x.status = "none_available_action"
|
||
x.save()
|
||
|
||
# -> alerting admin to manual assign
|
||
# try:
|
||
# to = settings.EMAIL_HOST_USER
|
||
# key_value = {
|
||
# "User": "Admin",
|
||
# "Stage": "(Actionlines and Dialogues)"
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP4", key_value=key_value)
|
||
# except:
|
||
# pass
|
||
|
||
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": "Admin",
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Algo is unable to assign LPP",
|
||
# "heading2": rf"{x.task_id}",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# EMAIL_HOST_USER,
|
||
# "Please manually reassign or Reject",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
# print("line 145---------")
|
||
return True
|
||
|
||
if fromeleigible == "eligible":
|
||
for i in list(x.eligiblelpp_action.all()):
|
||
if i.availabity == True:
|
||
print("reassign actionline")
|
||
x.assignedlpp_action = i
|
||
x.date_task_assigned = datetime.now()
|
||
x.eligiblelpp_action.remove(i)
|
||
x.status = "actionline_lppassigned"
|
||
x.save()
|
||
# Send mail to assigned LPP
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": x.assignedlpp_action.first_name,
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Get to Work!",
|
||
# "heading2": "More details you can find on Dashboard",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# x.assignedlpp_action.lpp_email,
|
||
# "A Task has been assigned to you",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
try:
|
||
to = x.assignedlpp_action.lpp_email
|
||
key_value = {
|
||
"User": x.assignedlpp_action.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
|
||
except:
|
||
pass
|
||
return True
|
||
# else:
|
||
print("Didn't find anyone for lpp")
|
||
x.status = "none_available_action"
|
||
x.save()
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": "Admin",
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Algo is unable to assign LPP",
|
||
# "heading2": rf"{x.task_id}",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# EMAIL_HOST_USER,
|
||
# "Please manually reassign or Reject",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
|
||
# -> alerting admin to manual assign
|
||
# try:
|
||
# to = settings.EMAIL_HOST_USER
|
||
# key_value = {
|
||
# "User": "Admin",
|
||
# "Stage": "(Actionlines)"
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP4", key_value=key_value)
|
||
#
|
||
# except:
|
||
# pass
|
||
return True
|
||
|
||
|
||
elif forwhichlines == "dialogue":
|
||
x.ratingonmachinetranslation_dialogue = 0
|
||
x.mistakeperpage_dialogue = ""
|
||
x.lppacceptancetime_dialogue = None
|
||
x.completiontime_dialogue = None
|
||
x.deadlinetolpp_dialogue = None
|
||
|
||
if fromeleigible == "eligible":
|
||
for i in list(x.eligiblelpp_dialogue.all()):
|
||
if i.availabity == True:
|
||
print("reassign dialogue eligble")
|
||
x.status = "dialogue_lppassigned"
|
||
# x.assignedlpp_dialogue.delete()
|
||
x.assignedlpp_dialogue = i
|
||
x.date_task_assigned = datetime.now()
|
||
x.eligiblelpp_dialogue.remove(i)
|
||
x.save()
|
||
# Send mail to assigned LPP
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": x.assignedlpp_dialogue.first_name,
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Get to Work!",
|
||
# "heading2": "More details you can find on Dashboard",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# x.assignedlpp_dialogue.lpp_email,
|
||
# "A Task has been assigned to you",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
#
|
||
|
||
# -> Send mail to assigned LPP
|
||
try:
|
||
to = x.assignedlpp_dialogue.lpp_email
|
||
key_value = {
|
||
"User": x.assignedlpp_dialogue.user_id.username,
|
||
"Stage": "(Dialogues)"
|
||
}
|
||
sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
except:
|
||
pass
|
||
return True
|
||
|
||
# else:
|
||
print("Didn't find anyone for lpp")
|
||
x.status = "none_available_dialogue"
|
||
x.save()
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": "Admin",
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Algo is unable to assign LPP",
|
||
# "heading2": rf"{x.task_id}",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# EMAIL_HOST_USER,
|
||
# "Please manually reassign or Reject",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
# try:
|
||
# to = settings.EMAIL_HOST_USER
|
||
# key_value = {
|
||
# "User": "Admin",
|
||
# "Stage": "(Dialogues)"
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP4", key_value=key_value)
|
||
# except:
|
||
# pass
|
||
return True
|
||
|
||
# elif forwhichlines == "subtitle":
|
||
# x.ratingonmachinetranslation_dialogue = 0
|
||
# x.mistakeperpage_dialogue = ""
|
||
# x.lppacceptancetime_dialogue = None
|
||
# x.completiontime_dialogue = None
|
||
# x.deadlinetolpp_dialogue = None
|
||
#
|
||
# if fromeleigible == "eligible":
|
||
# for i in list(x.eligiblelpp_dialogue.all()):
|
||
# if i.availabity == True:
|
||
# print("reassign subtitle eligble")
|
||
# x.status = "subtitle_lppassigned"
|
||
# # x.assignedlpp_dialogue.delete()
|
||
# x.assignedlpp_dialogue = i
|
||
# x.date_task_assigned = datetime.now()
|
||
# x.eligiblelpp_dialogue.remove(i)
|
||
# x.save()
|
||
# # Send mail to assigned LPP
|
||
# # with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# # body = f.read()
|
||
# #
|
||
# # context_email = {
|
||
# # "Date": date.today(),
|
||
# # "Name": x.assignedlpp_dialogue.first_name,
|
||
# # "emailcode": "LPP101",
|
||
# # "heading1": "Get to Work!",
|
||
# # "heading2": "More details you can find on Dashboard",
|
||
# # "body": body,
|
||
# # }
|
||
# # # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# # sendemail(
|
||
# # x.assignedlpp_dialogue.lpp_email,
|
||
# # "A Task has been assigned to you",
|
||
# # date.today(),
|
||
# # context_email,
|
||
# # EMAIL_HOST_USER,
|
||
# # ).start()
|
||
# try:
|
||
# to = x.assignedlpp_dialogue.lpp_email
|
||
# key_value = {
|
||
# "User": x.assignedlpp_dialogue.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
# except:
|
||
# pass
|
||
# return True
|
||
# # else:
|
||
# print("Didn't find anyone for lpp")
|
||
# x.status = "none_available_lpp"
|
||
# x.save()
|
||
#
|
||
# try:
|
||
# to = x.assignedlpp_dialogue.lpp_email
|
||
# key_value = {
|
||
# "User": x.assignedlpp_dialogue.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
# except:
|
||
# pass
|
||
# return True
|
||
#
|
||
#
|
||
#
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def LPPAction(request): # if LPP declines then assignes the task to next eligible LPP
|
||
# if LPP accepts then set task as in progress or completed depending upon outfile is provided
|
||
if request.method == "POST":
|
||
pk = request.POST.get("id")
|
||
if request.POST["actiontype"] == "Accept":
|
||
if LPPTASKDatabase.objects.filter(task_id=pk).exists():
|
||
x = LPPTASKDatabase.objects.get(task_id=pk)
|
||
if x.status == "actionline_lppassigned":
|
||
x.lppacceptancetime_action = datetime.today()
|
||
x.deadlinetolpp_action = datetime.today() + timedelta(days=math.ceil((x.translated_script.script_link_id.numPages)/15))
|
||
x.status = "actionline_inprogress"
|
||
x.save()
|
||
|
||
# -> LPP accepted the task so alert him
|
||
to = x.assignedlpp_action.lpp_email
|
||
key_value = {
|
||
"User": x.assignedlpp_action.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP8", key_value=key_value)
|
||
|
||
|
||
return redirect("/lpp/lpptask_dashboard/")
|
||
|
||
elif x.status == "actionline_inprogress":
|
||
if request.FILES.get("convertedfile"):
|
||
if str(x.translated_script.nondial_dest_language) == str(
|
||
x.translated_script.dial_dest_language) and str(
|
||
x.translated_script.script_link_id.nondial_src_language) == str(x.translated_script.script_link_id.dial_src_language):
|
||
|
||
x.completiontime_action = timezone.now()
|
||
x.outputfile = request.FILES["convertedfile"]
|
||
x.ratingonmachinetranslation_action = request.POST.get(
|
||
"ratingonmachinetranslation")
|
||
x.mistakeperpage_action = request.POST.get(
|
||
"mistakes")
|
||
x.status = "completed"
|
||
y = MNFLPPDDatabase.objects.get(
|
||
lpp_id=x.assignedlpp_action.lpp_id)
|
||
y.no_task_completed += 1
|
||
y.save()
|
||
check_promotion(y)
|
||
x.save()
|
||
convert_to_pdf(str(basepath) + "/media/" + str(x.outputfile),
|
||
str(basepath) + "/media/" + "lpptaskfolder")
|
||
pathspecific = ""
|
||
for i in (str(x.outputfile).split('.'))[:-1]:
|
||
pathspecific = pathspecific + "." + str(i)
|
||
saveFile = pathspecific[1:] + ".pdf"
|
||
x.outputfile.name = saveFile
|
||
x.save()
|
||
|
||
try:
|
||
temp1 = str(x.translated_script.script_link_id.script)
|
||
temp2 = str(x.outputfile)
|
||
uploaded_script = f"{basepath}/media/{temp1}"
|
||
translated_script = f"{basepath}/media/{temp2}"
|
||
|
||
data = [uploaded_script, translated_script]
|
||
print("Function 2")
|
||
files, timestamp = upload_multiFile_to_ipfs(
|
||
data, x.translated_script.script_title, "convertScript", x.translated_script.user_id.email)
|
||
x.translated_script.timestamp = timestamp
|
||
x.translated_script.uploaded_script_encoded = files[0]
|
||
x.translated_script.translated_script_encoded = files[1]
|
||
x.save()
|
||
|
||
|
||
except:
|
||
pass
|
||
|
||
|
||
# -> Generating Invoice
|
||
# invoice_values = {
|
||
# "pdf_name": f'{((str(x.translated_script.script).split("/"))[-1]).split(".")[0]}_Invoice.pdf',
|
||
# "lpp_name": f'{x.assignedlpp_action.first_name} {x.assignedlpp_action.last_name}',
|
||
# "lpp_contact": x.assignedlpp_action.contact,
|
||
# "source_lang": x.translated_script.dial_src_language,
|
||
# "target_lang": x.translated_script.dial_dest_language,
|
||
# "source_script": x.translated_script.dial_src_script,
|
||
# "target_script": x.translated_script.dial_dest_script,
|
||
# "date_of_assign": x.date_task_assigned,
|
||
# "duration": duration,
|
||
# "task_id": x.task_id,
|
||
# "file_name": x.translated_script.script_title,
|
||
# "type_of_work": "Whole Script Vetting",
|
||
# "task_origin": "Conversion",
|
||
# "amount": amount,
|
||
#
|
||
# }
|
||
#
|
||
#
|
||
# Invoice = Invoice_Generator(invoice_values)
|
||
# Invoice.generate_invoice()
|
||
|
||
# doc_fname = ((str(x.translated_script.script_file_path).split("/"))[-1]).split(".")[0]
|
||
#
|
||
# doc_name = f"{basepath}/media/lpp_invoice/{doc_fname}_Invoice.docx"
|
||
# doc.save(doc_name)
|
||
# pdf_name = f"{doc_fname}_Invoice.pdf"
|
||
# convert_to_pdf(doc_name, f"{basepath}/media/lpp_invoice/")
|
||
# x.lpp_invoice_action = pdf_name
|
||
# x.save()
|
||
|
||
lpp = MNFLPPDDatabase.objects.get(
|
||
lpp_id=x.assignedlpp_action.lpp_id)
|
||
try:
|
||
# lpp.lpp_task_balance += Decimal(
|
||
# x.amoutgiventolpp_action)
|
||
lpp.lpp_task_balance = float(Decimal(
|
||
str(lpp.lpp_task_balance))) + float(float(Decimal(str(x.amoutgiventolpp_action))) * usd_inr_rate)
|
||
except Exception as e:
|
||
print("LPP Balance Error", e)
|
||
lpp.lpp_task_balance = 0.00 + \
|
||
float(
|
||
float(Decimal(x.amoutgiventolpp_action)) * usd_inr_rate)
|
||
lpp.save()
|
||
|
||
rupees_amount = float(
|
||
Decimal(x.amoutgiventolpp_action)) * usd_inr_rate
|
||
# rupees_amount = 505.45
|
||
|
||
try:
|
||
central_wallet = Wallet.objects.get(
|
||
user=lpp.user_id)
|
||
central_wallet.balance = float(
|
||
central_wallet.balance) + float(rupees_amount)
|
||
central_wallet.lpp_balance = float(
|
||
central_wallet.lpp_balance) + float(rupees_amount)
|
||
central_wallet.save()
|
||
except Exception as e:
|
||
print("Error: ", e)
|
||
central_wallet = Wallet()
|
||
central_wallet.id = int(
|
||
Wallet.objects.all().last().id) + 1
|
||
central_wallet.user = lpp.user_id
|
||
central_wallet.balance = 0.0 + \
|
||
float(rupees_amount)
|
||
central_wallet.lpp_balance = 0.0 + \
|
||
float(rupees_amount)
|
||
central_wallet.save()
|
||
|
||
doc_fname = (
|
||
(str(x.translated_script.translation_id).split("/"))[-1]).split(".")[0]
|
||
x.lpp_invoice_action = f'{doc_fname}_Invoice.pdf'
|
||
x.save()
|
||
str1 = str(datetime.now()).split("-")
|
||
# from .utils import render_to_pdf
|
||
if x.assignedlpp_action.accountno:
|
||
data = ["0", x.assignedlpp_action.accountno, x.assignedlpp_action.nameofaccount,
|
||
x.assignedlpp_action.ifsccode]
|
||
else:
|
||
data = [
|
||
"1", x.assignedlpp_action.foreigndetails]
|
||
context = {
|
||
"lpp_name": f'{x.assignedlpp_action.first_name} {x.assignedlpp_action.last_name}',
|
||
"amount": f'{x.amoutgiventolpp_action}',
|
||
"bank": data,
|
||
"source_lang": x.translated_script.script_link_id.nondial_src_language,
|
||
"target_lang": x.translated_script.nondial_dest_language,
|
||
"source_script": x.translated_script.script_link_idnondial_src_script,
|
||
"target_script": x.translated_script.nondial_dest_script,
|
||
"date_assign": x.date_task_assigned,
|
||
"duration": (x.completiontime_action - x.lppacceptancetime_action).days,
|
||
"task_id": x.task_id,
|
||
"file_name": x.translated_script.script_link_id.script_title,
|
||
"type_of_work": "Whole Script Vetting",
|
||
"task_origin": "Conversion",
|
||
"date_at": f'{str1[0]} / {str1[1]} / {str1[2][0:2]}',
|
||
"lpp_country": x.assignedlpp_action.country,
|
||
"lpp_region": x.assignedlpp_action.province,
|
||
"lpp_city": x.assignedlpp_action.city,
|
||
"lpp_contact": x.assignedlpp_action.contact,
|
||
"invoice_no": str(int(time.time())),
|
||
"basepath": str(basepath),
|
||
|
||
}
|
||
template = get_template(
|
||
f'{basepath}/lpp/templates/lpp/desktop1.html')
|
||
html = template.render(context)
|
||
options = {
|
||
'page-size': 'A4',
|
||
'margin-top': '0.0in',
|
||
'margin-right': '0.0in',
|
||
'margin-bottom': '0.0in',
|
||
'margin-left': '0.0in',
|
||
}
|
||
|
||
|
||
if domain == "mynextfilm.ai":
|
||
options["enable-local-file-access"] = ""
|
||
elif domain == "1.6.141.104":
|
||
options["enable-local-file-access"] = ""
|
||
|
||
if not os.path.exists(f'{basepath}/media/lpp_invoice'):
|
||
os.makedirs(f'{basepath}/media/lpp_invoice', mode=0o777)
|
||
|
||
|
||
pdfkit.from_string(html, f'{basepath}/media/lpp_invoice/{doc_fname}_Invoice.pdf',
|
||
options=options, verbose=True)
|
||
|
||
# -> LPP completed the task so alert him about invoice
|
||
to = x.assignedlpp_action.lpp_email
|
||
key_value = {
|
||
"User": x.assignedlpp_action.user_id.username,
|
||
"Amount": x.amoutgiventolpp_action
|
||
}
|
||
sendmail(to_email=[to], email_code="PP14", key_value=key_value)
|
||
|
||
|
||
return redirect("/lpp/lpptask_dashboard/")
|
||
|
||
x.completiontime_action = timezone.now()
|
||
x.outputfile = request.FILES["convertedfile"]
|
||
x.ratingonmachinetranslation_action = request.POST.get(
|
||
"ratingonmachinetranslation")
|
||
x.mistakeperpage_action = request.POST.get("mistakes")
|
||
x.status = "actionline_completed"
|
||
print("Saving details in LPP upload")
|
||
x.save()
|
||
|
||
# -> Generating Invoice
|
||
# invoice_values = {
|
||
# "pdf_name": f'{((str(x.translated_script.script).split("/"))[-1]).split(".")[0]}_Invoice.pdf',
|
||
# "lpp_name": f'{x.assignedlpp_action.first_name} {x.assignedlpp_action.last_name}',
|
||
# "lpp_contact": x.assignedlpp_action.contact,
|
||
# "source_lang": x.translated_script.dial_src_language,
|
||
# "target_lang": x.translated_script.dial_dest_language,
|
||
# "source_script": x.translated_script.dial_src_script,
|
||
# "target_script": x.translated_script.dial_dest_script,
|
||
# "date_of_assign": x.date_task_assigned,
|
||
# "duration": duration,
|
||
# "task_id": x.task_id,
|
||
# "file_name": x.translated_script.script_title,
|
||
# "type_of_work": "Only Actionlines Vetting",
|
||
# "task_origin": "Conversion",
|
||
# "amount": amount,
|
||
#
|
||
# }
|
||
#
|
||
#
|
||
# Invoice = Invoice_Generator(invoice_values)
|
||
# Invoice.generate_invoice()
|
||
|
||
# doc = docx.Document()
|
||
#
|
||
# #add to docx
|
||
# slug_data = doc.add_paragraph()
|
||
# slug_data_format = slug_data.paragraph_format
|
||
# slug_data_format.space_after = Pt(12)
|
||
# slug_data_format.keep_with_next = True
|
||
# slug_data_format.left_indent = Inches(0)
|
||
# slug_data.style.font.name = 'Courier New'
|
||
# slug_data.style.font.size = Pt(12.0)
|
||
# slug_data.add_run("Your LPP Task Amount: ").bold = True
|
||
#
|
||
#
|
||
# slug_data = doc.add_paragraph()
|
||
# slug_data_format = slug_data.paragraph_format
|
||
# slug_data_format.space_after = Pt(12)
|
||
# slug_data_format.keep_with_next = True
|
||
# slug_data_format.left_indent = Inches(0)
|
||
# slug_data.style.font.name = 'Courier New'
|
||
# slug_data.style.font.size = Pt(12.0)
|
||
# task_amount = str(x.amoutgiventolpp_action)
|
||
# slug_data.add_run("$ " + task_amount).bold = False
|
||
#
|
||
# doc_fname = ((str(x.translated_script.script_file_path).split("/"))[-1]).split(".")[0]
|
||
#
|
||
#
|
||
# doc_name = f"{basepath}/media/lpp_invoice/{doc_fname}_Invoice.docx"
|
||
# doc.save(doc_name)
|
||
# pdf_name = f"{doc_fname}_Invoice.pdf"
|
||
# convert_to_pdf(doc_name, f"{basepath}/media/lpp_invoice/")
|
||
# x.lpp_invoice_action = pdf_name
|
||
# x.save()
|
||
|
||
lpp = MNFLPPDDatabase.objects.get(
|
||
lpp_id=x.assignedlpp_action.lpp_id)
|
||
try:
|
||
# lpp.lpp_task_balance += Decimal(
|
||
# x.amoutgiventolpp_action)
|
||
lpp.lpp_task_balance = float(Decimal(
|
||
str(lpp.lpp_task_balance))) + float(float(Decimal(str(x.amoutgiventolpp_action))) * usd_inr_rate)
|
||
except Exception as e:
|
||
print("LPP Balance Error", e)
|
||
lpp.lpp_task_balance = 0.00 + \
|
||
float(
|
||
float(Decimal(x.amoutgiventolpp_action)) * usd_inr_rate)
|
||
lpp.save()
|
||
|
||
rupees_amount = float(
|
||
Decimal(x.amoutgiventolpp_action)) * usd_inr_rate
|
||
# rupees_amount = 505.45
|
||
|
||
try:
|
||
central_wallet = Wallet.objects.get(
|
||
user=lpp.user_id)
|
||
central_wallet.balance = float(
|
||
central_wallet.balance) + float(rupees_amount)
|
||
central_wallet.lpp_balance = float(
|
||
central_wallet.lpp_balance) + float(rupees_amount)
|
||
central_wallet.save()
|
||
except Exception as e:
|
||
print("Error: ", e)
|
||
central_wallet = Wallet()
|
||
central_wallet.id = int(
|
||
Wallet.objects.all().last().id) + 1
|
||
central_wallet.user = lpp.user_id
|
||
central_wallet.balance = 0.0 + float(rupees_amount)
|
||
central_wallet.lpp_balance = 0.0 + \
|
||
float(rupees_amount)
|
||
central_wallet.save()
|
||
|
||
doc_fname = (
|
||
(str(x.translated_script.translation_id).split("/"))[-1]).split(".")[0]
|
||
x.lpp_invoice_action = f'{doc_fname}_Invoice.pdf'
|
||
x.save()
|
||
str1 = str(datetime.now()).split("-")
|
||
# from .utils import render_to_pdf
|
||
|
||
y = MNFLPPDDatabase.objects.get(
|
||
lpp_id=x.assignedlpp_action.lpp_id)
|
||
y.no_task_completed += 1
|
||
y.save()
|
||
|
||
if x.assignedlpp_action.accountno:
|
||
data = ["0", x.assignedlpp_action.accountno, x.assignedlpp_action.nameofaccount,
|
||
x.assignedlpp_action.ifsccode]
|
||
else:
|
||
data = ["1", x.assignedlpp_action.foreigndetails]
|
||
context = {
|
||
"lpp_name": f'{x.assignedlpp_action.first_name} {x.assignedlpp_action.last_name}',
|
||
"amount": f'{x.amoutgiventolpp_action}',
|
||
"bank": data,
|
||
"source_lang": x.translated_script.script_link_id.nondial_src_language,
|
||
"target_lang": x.translated_script.nondial_dest_language,
|
||
"source_script": x.translated_script.script_link_id.nondial_src_script,
|
||
"target_script": x.translated_script.nondial_dest_script,
|
||
"date_assign": x.date_task_assigned,
|
||
"duration": (x.completiontime_action - x.lppacceptancetime_action).days,
|
||
"task_id": x.task_id,
|
||
"file_name": x.translated_script.script_link_id.script_title,
|
||
"type_of_work": "Only Actionlines Vetting",
|
||
"task_origin": "Conversion",
|
||
"date_at": f'{str1[0]} / {str1[1]} / {str1[2][0:2]}',
|
||
"lpp_country": x.assignedlpp_action.country,
|
||
"lpp_region": x.assignedlpp_action.province,
|
||
"lpp_city": x.assignedlpp_action.city,
|
||
"lpp_contact": x.assignedlpp_action.contact,
|
||
"invoice_no": str(int(time.time())),
|
||
"basepath": str(basepath),
|
||
|
||
}
|
||
template = get_template(
|
||
f'{basepath}/lpp/templates/lpp/desktop1.html')
|
||
html = template.render(context)
|
||
options = {
|
||
'page-size': 'A4',
|
||
'margin-top': '0.0in',
|
||
'margin-right': '0.0in',
|
||
'margin-bottom': '0.0in',
|
||
'margin-left': '0.0in',
|
||
}
|
||
if domain == "mynextfilm.ai":
|
||
options["enable-local-file-access"] = ""
|
||
elif domain == "1.6.141.104":
|
||
options["enable-local-file-access"] = ""
|
||
if not os.path.exists(f'{basepath}/media/lpp_invoice'):
|
||
os.makedirs(f'{basepath}/media/lpp_invoice', mode=0o777)
|
||
pdfkit.from_string(html, f'{basepath}/media/lpp_invoice/{doc_fname}_Invoice.pdf',
|
||
options=options, verbose=True)
|
||
|
||
|
||
|
||
to = x.assignedlpp_action.lpp_email
|
||
key_value = {
|
||
"User": x.assignedlpp_action.user_id.username,
|
||
"Amount": x.amoutgiventolpp_action
|
||
}
|
||
sendmail(to_email=[to], email_code="PP14", key_value=key_value)
|
||
task_assigner(pk, x.generated_from)
|
||
|
||
|
||
|
||
print("Successfully saved in LPP upload")
|
||
print("*" * 50)
|
||
print("calling lpp upload function", x)
|
||
|
||
else:
|
||
print("Accept1 ", x.lppacceptancetime_action)
|
||
x.ratingonmachinetranslation_action = request.POST.get(
|
||
"ratingonmachinetranslation"
|
||
)
|
||
x.mistakeperpage_action = request.POST.get("mistakes")
|
||
x.status = "actionline_inprogress"
|
||
x.save()
|
||
|
||
to = x.assignedlpp_action.lpp_email
|
||
key_value = {
|
||
"User": x.assignedlpp_action.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP8", key_value=key_value)
|
||
|
||
return redirect("/lpp/lpptask_dashboard/")
|
||
|
||
elif x.status == "dialogue_lppassigned":
|
||
x.lppacceptancetime_dialogue = datetime.today()
|
||
try:
|
||
x.deadlinetolpp_dialogue = datetime.today() + timedelta(days=math.ceil((x.translated_script.script_link_id.numPages)/15))
|
||
except:
|
||
x.deadlinetolpp_dialogue = datetime.today() + timedelta(
|
||
days=math.ceil((x.translated_ppt.slide_count) / 15))
|
||
x.status = "dialogue_inprogress"
|
||
x.save()
|
||
|
||
to = x.assignedlpp_dialogue.lpp_email
|
||
key_value = {
|
||
"User": x.assignedlpp_dialogue.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP8", key_value=key_value)
|
||
|
||
return redirect("/lpp/lpptask_dashboard/")
|
||
|
||
elif x.status == "dialogue_inprogress":
|
||
if request.FILES.get("convertedfile"):
|
||
print("Accept1 ", x.lppacceptancetime_action)
|
||
# if x.lppacceptancetime_dialogue == "":
|
||
# x.lppacceptancetime_dialogue = datetime.today()
|
||
x.completiontime_dialogue = datetime.today()
|
||
x.outputfile = request.FILES["convertedfile"]
|
||
x.ratingonmachinetranslation_dialogue = request.POST.get(
|
||
"ratingonmachinetranslation")
|
||
x.mistakeperpage_dialogue = request.POST.get(
|
||
"mistakes")
|
||
x.status = "dialogue_completed"
|
||
print("Saving details in LPP upload")
|
||
x.save()
|
||
|
||
|
||
|
||
|
||
# case for ppt cause it does not have actionline lpp
|
||
if x.assignedlpp_action:
|
||
task_assigner(pk, x.generated_from)
|
||
else:
|
||
task_assigner(pk, "conversion_ppt")
|
||
print("Successfully saved in LPP upload")
|
||
print("*" * 50)
|
||
print("calling lpp upload function", x)
|
||
|
||
else:
|
||
print("Accept1 ", x.lppacceptancetime_action)
|
||
# if x.lppacceptancetime_dialogue == "":
|
||
# x.lppacceptancetime_dialogue = datetime.today()
|
||
x.ratingonmachinetranslation_dialogue = request.POST.get(
|
||
"ratingonmachinetranslation"
|
||
)
|
||
x.mistakeperpage_dialogue = request.POST.get(
|
||
"mistakes")
|
||
x.status = "dialogue_inprogress"
|
||
x.save()
|
||
|
||
to = x.assignedlpp_dialogue.lpp_email
|
||
key_value = {
|
||
"User": x.assignedlpp_dialogue.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP8", key_value=key_value)
|
||
|
||
return redirect("/lpp/lpptask_dashboard/")
|
||
|
||
# elif x.status == "subtitle_lppassigned":
|
||
# print("Accept1 ", x.lppacceptancetime_dialogue)
|
||
# # if x.lppacceptancetime_dialogue == "":
|
||
# x.lppacceptancetime_dialogue = datetime.today()
|
||
# x.deadlinetolpp_dialogue = datetime.today() + timedelta(days=math.ceil((x.translated_subtitle.video_duration)/1800))
|
||
# x.status = "subtitle_vetting_inprogress"
|
||
# x.save()
|
||
#
|
||
# to = x.assignedlpp_dialogue.lpp_email
|
||
# key_value = {
|
||
# "User": x.assignedlpp_dialogue.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP8", key_value=key_value)
|
||
#
|
||
# return redirect("/lpp/lpptask_dashboard/")
|
||
#
|
||
# elif x.status == "subtitle_vetting_inprogress":
|
||
# if x.translated_subtitle.status == "completed":
|
||
# x.completiontime_dialogue = datetime.today()
|
||
# x.ratingonmachinetranslation_dialogue = request.POST.get(
|
||
# "ratingonmachinetranslation")
|
||
# x.mistakeperpage_dialogue = request.POST.get(
|
||
# "mistakes")
|
||
# x.status = "subtitle_completed"
|
||
# print("Saving details in LPP upload")
|
||
# x.save()
|
||
#
|
||
# # case for ppt cause it does not have actionline lpp
|
||
# task_assigner(pk, x.generated_from)
|
||
# # else:
|
||
# # task_assigner(pk, "conversion_ppt")
|
||
# print("Successfully saved in LPP upload")
|
||
# print("*" * 50)
|
||
# print("calling lpp upload function", x)
|
||
#
|
||
# else:
|
||
# x.ratingonmachinetranslation_dialogue = request.POST.get(
|
||
# "ratingonmachinetranslation"
|
||
# )
|
||
# x.mistakeperpage_dialogue = request.POST.get(
|
||
# "mistakes")
|
||
# # x.status = "dialogue_inprogress"
|
||
# x.save()
|
||
# return redirect("/lpp/lpptask_dashboard/")
|
||
|
||
if request.POST["actiontype"] == "Decline":
|
||
if LPPTASKDatabase.objects.filter(task_id=pk).exists():
|
||
x = LPPTASKDatabase.objects.get(task_id=pk)
|
||
if x.status == "actionline_lppassigned" or x.status == "actionline_inprogress":
|
||
if str(x.translated_script.nondial_dest_language) == str(
|
||
x.translated_script.dial_dest_language) and str(
|
||
x.translated_script.script_link_id.nondial_src_language) == str(x.translated_script.script_link_id.dial_src_language):
|
||
if len(list(x.eligiblelpp_action.all())) > 0:
|
||
reassign_task(pk, "action", "eligible")
|
||
else:
|
||
reassign_task(pk, "action", "noneligible")
|
||
return redirect("/lpp/lpptask_dashboard/")
|
||
if len(list(x.eligiblelpp_action.all())) > 0:
|
||
reassign_task(pk, "action", "eligible")
|
||
else:
|
||
reassign_task(pk, "action", "noneligible")
|
||
elif x.status == "dialogue_lppassigned" or x.status == "dialogue_inprogress":
|
||
if len(list(x.eligiblelpp_dialogue.all())) > 0:
|
||
reassign_task(pk, "dialogue", "eligible")
|
||
else:
|
||
reassign_task(pk, "dialogue", "noneligible")
|
||
# elif x.status == "subtitle_lppassigned" or x.status == "subtitle_vetting_inprogress":
|
||
# if len(list(x.eligiblelpp_dialogue.all())) > 0:
|
||
# reassign_task(pk, "subtitle", "eligible")
|
||
# else:
|
||
# reassign_task(pk, "subtitle", "noneligible")
|
||
|
||
# email_message = EmailMessage(
|
||
# "Update on your translation request",
|
||
# "Hi "
|
||
# + str(request.user.first_name)
|
||
# + " "
|
||
# + str(request.user.last_name)
|
||
# + ",\nYour Conversion "
|
||
# + str(x.taskname)
|
||
# + " is being declined by our language pair expert and there is no more lpp for this language",
|
||
# settings.EMAIL_HOST_USER,
|
||
# [x.user_id],
|
||
# )
|
||
# email_message.send()
|
||
# print("Email sent")
|
||
# return HttpResponse(
|
||
# "You declined the task, so you have no assign task!"
|
||
# )
|
||
# x.ratingonmachinetranslation = request.POST.get('rating')
|
||
# x.mistakeperpage = request.POST.get('mistakes')
|
||
# x.outputfile = request.FILES['convertedfile']
|
||
|
||
# x.save()
|
||
return redirect("/lpp/lpptask_dashboard/")
|
||
|
||
# if request.POST["Action"] == "Cancel":
|
||
# if LPPTASKDatabase.objects.filter(id=pk).exists():
|
||
# x = LPPTASKDatabase.objects.get(id=pk)
|
||
# x.status = 'Canceled'
|
||
# x.save()
|
||
# email_message = EmailMessage(
|
||
# "Update on your translation request",
|
||
# "Hi "+str(x.user.first_name)+' '+str(x.user.last_name) +
|
||
# ",\nYour Conversion"+str(x.taskname)+" is being vetted by our language pair expert",
|
||
# settings.EMAIL_HOST_USER,
|
||
# [x.user.email]
|
||
# )
|
||
# email_message
|
||
# return redirect('/lpp/adminpanel/')
|
||
return redirect("/lpp/lpptask_dashboard/")
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def Update(request):
|
||
if request.user.is_superuser:
|
||
if request.method == "POST":
|
||
print(request.POST["status"])
|
||
pk = request.POST["lppid"]
|
||
if request.POST["status"] == "Shortlist":
|
||
print("Line 1 in shortlist")
|
||
if MNFLPPDDatabase.objects.filter(lpp_id=pk).exists():
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=pk)
|
||
x.status = "Shortlisted"
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP111",
|
||
# "heading1": "Congrats you are shortlisted for review!",
|
||
# "heading2": "We will get back to you ASAP!",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# x.lpp_email,
|
||
# "You are shortlisted!",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
print("Line 10 in shortlist")
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="ID16", key_value=key_value)
|
||
print("mail sended in shortlist")
|
||
|
||
x.save()
|
||
return redirect("/lpp/adminpanel/")
|
||
|
||
elif request.POST["status"] == "Select":
|
||
if MNFLPPDDatabase.objects.filter(lpp_id=pk).exists():
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=pk)
|
||
x.status = "Selected"
|
||
x.approved_on = datetime.now()
|
||
x.save()
|
||
|
||
# Adding the LPP string in active list of Wallet
|
||
try:
|
||
central_wallet = Wallet.objects.get(user=x.user_id)
|
||
l = central_wallet.get_active_list()
|
||
l.append("LPP")
|
||
central_wallet.set_active_list(l)
|
||
central_wallet.save()
|
||
except Exception as e:
|
||
central_wallet = Wallet()
|
||
if Wallet.objects.all().exists():
|
||
central_wallet.id = int(
|
||
Wallet.objects.all().last().id) + 1
|
||
else:
|
||
central_wallet.id = 1
|
||
|
||
l = []
|
||
l.append("LPP")
|
||
central_wallet.set_active_list(l)
|
||
central_wallet.user = x.user_id
|
||
central_wallet.save()
|
||
|
||
# subject = "Congratulations! Your application has been selected by our Admin"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
# to = x.lpp_email
|
||
# context = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP103",
|
||
# "heading1": " Application selected ",
|
||
# "heading2": "Let's get to Work!",
|
||
# }
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/lpp/templates/lpp/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username
|
||
}
|
||
sendmail(to_email=[to], email_code="ID8", key_value=key_value)
|
||
|
||
|
||
return redirect("/lpp/adminpanel/")
|
||
|
||
elif request.POST["status"] == "Reject":
|
||
if MNFLPPDDatabase.objects.filter(lpp_id=pk).exists():
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=pk)
|
||
# subject = "Your application has been rejected by our Admin"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
# to = x.lpp_email
|
||
# context = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP104",
|
||
# "heading1": " Application rejected ",
|
||
# "heading2": request.POST.get("reason"),
|
||
# }
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/lpp/templates/lpp/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username,
|
||
"reason": request.POST.get("reason_reject")
|
||
}
|
||
sendmail(to_email=[to], email_code="ID6", key_value=key_value)
|
||
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="ID19", key_value=key_value)
|
||
|
||
x.delete()
|
||
return redirect("/lpp/adminpanel/")
|
||
|
||
elif request.POST["status"] == "Terminate":
|
||
if MNFLPPDDatabase.objects.filter(lpp_id=pk).exists():
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=pk)
|
||
x.status = "Terminated"
|
||
x.save()
|
||
|
||
# Reassigning of his tasks
|
||
# tasks = LPPTASKDatabase.objects.filter(Q(assignedlpp_action=MNFLPPDDatabase.objects.get(
|
||
# lpp_id=pk)) | Q(assignedlpp_dialogue=MNFLPPDDatabase.objects.get(lpp_id=pk)))
|
||
#
|
||
# for task in tasks:
|
||
# if task.assignedlpp_dialogue == MNFLPPDDatabase.objects.get(lpp_id=pk):
|
||
# if len(list(task.eligiblelpp_dialogue.all())) > 0:
|
||
# reassign_task(task.task_id, "dialogue", "eligible")
|
||
# else:
|
||
# reassign_task(
|
||
# task.task_id, "dialogue", "noneligible")
|
||
# else:
|
||
# if len(list(task.eligiblelpp_action.all())) > 0:
|
||
# reassign_task(task.task_id, "action", "eligible")
|
||
# else:
|
||
# reassign_task(
|
||
# task.task_id, "action", "noneligible")
|
||
|
||
# subject = "Application terminated by our Admin"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
# to = x.lpp_email
|
||
# context = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP105",
|
||
# "heading1": " Sorry to inform you that your journey with MNF has come to an end! ",
|
||
# "heading2": "Good Luck for future!",
|
||
# }
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/lpp/templates/lpp/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="ID14", key_value=key_value)
|
||
|
||
return redirect("/lpp/adminpanel/")
|
||
|
||
elif request.POST["status"] == "Promote":
|
||
if MNFLPPDDatabase.objects.filter(lpp_id=pk).exists():
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=pk)
|
||
if x.level == "Beginner":
|
||
x.level = "Proficient"
|
||
elif x.level == "Proficient":
|
||
x.level = "Expert"
|
||
elif x.level == "Expert":
|
||
x.level = "Expert"
|
||
else:
|
||
x.level = "Beginner"
|
||
x.status = "Selected"
|
||
x.save()
|
||
# subject = "Congrats! You have been promoted by our Admin"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
# to = x.lpp_email
|
||
# context = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP106",
|
||
# "heading1": f" You leveled-up to {x.level} ",
|
||
# "heading2": "Keep up the good work!",
|
||
# }
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/lpp/templates/lpp/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="ID15", key_value=key_value)
|
||
|
||
|
||
return redirect("/lpp/adminpanel/")
|
||
|
||
elif request.POST["status"] == "On Hold":
|
||
if MNFLPPDDatabase.objects.filter(lpp_id=pk).exists():
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=pk)
|
||
x.nda.delete()
|
||
x.status = "On Hold"
|
||
x.save()
|
||
|
||
# subject = "Application on hold!"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
# to = x.lpp_email
|
||
# context = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP108",
|
||
# "heading1": " Make applicable corrections! ",
|
||
# "heading2": request.POST.get("reason"),
|
||
# }
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/lpp/templates/lpp/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username,
|
||
"reason":request.POST.get("reason")
|
||
}
|
||
sendmail(to_email=[to], email_code="ID7", key_value=key_value)
|
||
|
||
|
||
return redirect("/lpp/adminpanel/")
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def updatebankdetails(request):
|
||
pk = request.POST["id"]
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=pk)
|
||
if request.method == "POST":
|
||
if request.POST.get("accountno"):
|
||
x.bankname = request.POST.get("bankname")
|
||
x.accountno = request.POST.get("accountno")
|
||
x.ifsccode = request.POST.get("ifsccode")
|
||
x.nameofaccount = request.POST.get("nameofaccount")
|
||
elif request.POST.get("foreigndetails"):
|
||
x.foreigndetails = request.POST.get("foreigndetails")
|
||
else:
|
||
x.bankname = ""
|
||
x.accountno = ""
|
||
x.ifsccode = ""
|
||
x.nameofaccount = ""
|
||
x.foreigndetails = ""
|
||
|
||
|
||
x.save()
|
||
|
||
# -> Bank details update email
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username
|
||
}
|
||
sendmail(to_email=[to], email_code="ID10", key_value=key_value)
|
||
|
||
return redirect("lpptask_dashboard")
|
||
|
||
|
||
def NonDisclosureAgreement(request, mode):
|
||
if mode == "0":
|
||
if request.method == "POST":
|
||
pk = request.POST["id"]
|
||
if not os.path.exists(f'{basepath}/media/lpp_documents'):
|
||
os.makedirs(f'{basepath}/media/lpp_documents', mode=0o777)
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=pk)
|
||
x.nda = request.FILES["nda"]
|
||
x.save()
|
||
|
||
# subject = "Someone has uploaded NDA! Please review application"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
# to = settings.EMAIL_HOST_USER
|
||
# context = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP2",
|
||
# "heading1": " Kindly review applicant ",
|
||
# "heading2": " ASAP! ",
|
||
# }
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/lpp/templates/lpp/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.attach_file(f"{basepath}/media/{x.nda}")
|
||
# msg.send()
|
||
#
|
||
# subject = "Thank You for uploading NDA"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
# to = x.lpp_email
|
||
# context = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP3",
|
||
# "heading1": " Thanks applicant ",
|
||
# "heading2": " We will get back soon! ",
|
||
# }
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/lpp/templates/lpp/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
# subj = ""
|
||
# content = ""
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
# to = request.user.email
|
||
# msg = EmailMultiAlternatives(subj, content, from_email, [to])
|
||
# # msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username
|
||
}
|
||
sendmail(to_email=[to], email_code="ID4", key_value=key_value)
|
||
|
||
return redirect("lpptask_dashboard")
|
||
|
||
# print("1784")
|
||
|
||
elif mode == "1":
|
||
if request.method == "POST":
|
||
pk = request.POST["id"]
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=pk)
|
||
x.nda.delete()
|
||
x.save()
|
||
# template = get_template("lpp/nda.html")
|
||
# context = {
|
||
# "source_lang": x.firstLanguage,
|
||
# "target_lang": x.secondLanguage,
|
||
# "name": x.first_name,
|
||
# "status": "Shortlisted by Algo",
|
||
# "user": request.user,
|
||
# }
|
||
# html = template.render(context)
|
||
# pdf = render_to_pdf("lpp/nda.html", context)
|
||
# # response = HttpResponse(pdf, content_type="application/pdf")
|
||
# # Send Email
|
||
#
|
||
# subject = "Requested NDA received!"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
# to = x.lpp_email
|
||
# context = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP102",
|
||
# "heading1": " Kindly Upload signed NDA ",
|
||
# "heading2": " Attached with this Email ",
|
||
# }
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/lpp/templates/lpp/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.attach_file(
|
||
# rf"/{basepath}/media/PdfFiles/MNF-NDA.pdf")
|
||
# msg.send()
|
||
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username
|
||
}
|
||
sendmail(to_email=[to], email_code="ID5", key_value=key_value,
|
||
filePath=rf"/{basepath}/media/PdfFiles/MNF-NDA.pdf")
|
||
|
||
return redirect("lpptask_dashboard")
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def availabity(request):
|
||
if request.method == "POST":
|
||
pk = request.POST["id"]
|
||
x = MNFLPPDDatabase.objects.get(lpp_id=pk)
|
||
print(x.first_name, "First Nameee")
|
||
if request.POST.get("availabity") == "Yes":
|
||
x.availabity = True
|
||
x.save()
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP110",
|
||
# "heading1": "LPP available",
|
||
# "heading2": f"From {date.today()}",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# EMAIL_HOST_USER,
|
||
# f"{x.first_name} is now available",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
|
||
|
||
else:
|
||
x.availabity = False
|
||
print("Avail no")
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": x.first_name,
|
||
# "emailcode": "LPP110",
|
||
# "heading1": "LPP unavailable",
|
||
# "heading2": f"From {date.today()}",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# EMAIL_HOST_USER,
|
||
# f"{x.first_name} unavailable",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="ID22", key_value=key_value)
|
||
|
||
x.save()
|
||
print("Email sentttttt successfully!")
|
||
# y = LPPTASKDatabase.objects.filter(Q(assignedlpp_action=MNFLPPDDatabase.objects.get(
|
||
# lpp_id=pk)) | Q(assignedlpp_dialogue=MNFLPPDDatabase.objects.get(lpp_id=pk)))
|
||
# try:
|
||
# for item in y:
|
||
# if item.status == "completed" or item.status == "actionline_completed" or item.status == "dialogue_completed" \
|
||
# or item.status == "none_available_dialogue":
|
||
# pass
|
||
# else:
|
||
# if item.assignedlpp_action == MNFLPPDDatabase.objects.get(lpp_id=pk):
|
||
# if str(item.translated_script.nondial_dest_language) == str(
|
||
# item.translated_script.dial_dest_language) and str(
|
||
# item.translated_script.script_link_id.nondial_src_language) == str(item.translated_script.script_link_id.dial_src_language):
|
||
# if len(list(item.eligiblelpp_action.all())) > 0:
|
||
# reassign_task(
|
||
# item.task_id, "action", "eligible")
|
||
# else:
|
||
# reassign_task(
|
||
# item.task_id, "action", "noneligible")
|
||
# if len(list(item.eligiblelpp_action.all())) > 0:
|
||
# reassign_task(item.task_id, "action", "eligible")
|
||
# else:
|
||
# reassign_task(
|
||
# item.task_id, "action", "noneligible")
|
||
# elif item.assignedlpp_dialogue == MNFLPPDDatabase.objects.get(lpp_id=pk):
|
||
#
|
||
# if len(list(item.eligiblelpp_dialogue.all())) > 0:
|
||
# reassign_task(item.task_id, "dialogue", "eligible")
|
||
# else:
|
||
# reassign_task(
|
||
# item.task_id, "dialogue", "noneligible")
|
||
# except Exception as e:
|
||
# print("Error for LPP is:", e)
|
||
|
||
print(x.availabity, " :Out of condition")
|
||
return redirect("lpptask_dashboard")
|
||
|
||
|
||
|
||
def get_possible_tasks(lpp_id):
|
||
possible_tasks = []
|
||
|
||
lpp = MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
source_and_target_langs = [lpp.firstLanguage, lpp.firstLanguage]
|
||
y = (
|
||
LPPTASKDatabase.objects.exclude(status="completed")
|
||
.exclude(assignedlpp_action=lpp)
|
||
.exclude(assignedlpp_dialogue=lpp)
|
||
)
|
||
translated_scripts = y.filter(translated_script__isnull=False)
|
||
# translated_ppts = y.filter(translated_ppt__isnull=False)
|
||
# subtitles = y.filter(translated_subtitle__isnull=False)
|
||
|
||
for task in translated_scripts:
|
||
if task.status == "" or task.status == "actionline_inprogress" or task.status == "actionline_lppassigned" or task.status == "none_available_action":
|
||
if languages[task.translated_script.script_link_id.nondial_src_language] in source_and_target_langs and languages[task.translated_script.nondial_dest_language] in source_and_target_langs:
|
||
possible_tasks.append(task)
|
||
else:
|
||
if languages[task.translated_script.script_link_id.dial_src_language] in source_and_target_langs and languages[task.translated_script.dial_dest_language] in source_and_target_langs:
|
||
possible_tasks.append(task)
|
||
|
||
# for task in translated_ppts:
|
||
# if task.translated_ppt.source_lang in source_and_target_langs and task.translated_ppt.target_lang in source_and_target_langs:
|
||
# possible_tasks.append(task)
|
||
|
||
# for task in subtitles:
|
||
# if task.translated_subtitle.subtitles_id.src_languages.language in source_and_target_langs and task.translated_subtitle.tar_languages.language in source_and_target_langs:
|
||
# possible_tasks.append(task)
|
||
|
||
return possible_tasks
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def manualassign(request, id):
|
||
if request.user.is_superuser:
|
||
if request.method == "POST":
|
||
print("Entering Manual Assign")
|
||
|
||
if not id:
|
||
task_id = request.POST.get("task_id")
|
||
lpp_id = request.POST.get("lpp_id")
|
||
else:
|
||
task_id = request.POST.get("task")
|
||
lpp_id = request.POST.get("lpp")
|
||
print(task_id, lpp_id)
|
||
y = LPPTASKDatabase.objects.get(task_id=task_id)
|
||
check_if_possible_empty(y, LPPTASKDatabase.objects.get(lpp_id=lpp_id))
|
||
try:
|
||
# which lpp to be sent the old lpp email cases - #Send mail to assigned LPP(OLD LPP EMAIL)
|
||
if y.status == "" or y.status == "none_available_action" or y.status == "none_available_dialogue" or y.status == "none_available_lpp":
|
||
pass
|
||
elif y.status == "actionline_lppassigned" or y.status == "actionline_inprogress":
|
||
old_lpp_email = y.assignedlpp_action.lpp_email
|
||
old_lpp_first_name = y.assignedlpp_action.first_name
|
||
to = old_lpp_email
|
||
key_value = {
|
||
"User": y.assignedlpp_action.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP7", key_value=key_value)
|
||
elif y.status == "dialogue_lppassigned" or y.status == "dialogue_inprogress":
|
||
|
||
old_lpp_email = y.assignedlpp_dialogue.lpp_email
|
||
old_lpp_first_name = y.assignedlpp_dialogue.first_name
|
||
|
||
to = old_lpp_email
|
||
key_value = {
|
||
"User": y.assignedlpp_dialogue.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP7", key_value=key_value)
|
||
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": old_lpp_first_name,
|
||
# "emailcode": "LPP107",
|
||
# "heading1": "Sorry to inform you that your task is assigned to someone else!",
|
||
# "heading2": "Hope you will get a new task soon!",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# old_lpp_email,
|
||
# "Task Re-assigned",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
except:
|
||
print("No OLD LPP FOUND SO NO MAIL TO OLD LPP")
|
||
|
||
if y.translated_ppt:
|
||
print("if of ppt")
|
||
if y.status == "" or y.status == "dialogue_lppassigned" or\
|
||
y.status == "dialogue_inprogress" or y.status == "none_available_dialogue":
|
||
y.assignedlpp_dialogue = MNFLPPDDatabase.objects.get(
|
||
lpp_id=lpp_id)
|
||
y.lppacceptancetime_dialogue = None
|
||
y.deadlinetolpp_dialogue = None
|
||
y.date_task_assigned = datetime.now()
|
||
y.status = "dialogue_lppassigned"
|
||
z = y.eligiblelpp_dialogue.all()
|
||
if MNFLPPDDatabase.objects.get(lpp_id=lpp_id) in list(z):
|
||
y.eligiblelpp_dialogue.remove(
|
||
MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
)
|
||
y.save()
|
||
new_lpp = MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
# New Assigned LPP Email
|
||
to = new_lpp.lpp_email
|
||
key_value = {
|
||
"User": new_lpp.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP3", key_value=key_value)
|
||
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": new_lpp.first_name,
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Get to Work!",
|
||
# "heading2": "More details you can find on Dashboard",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# new_lpp.lpp_email,
|
||
# "A Task has been assigned to you",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
elif y.translated_script:
|
||
print("elif of script")
|
||
if y.status == "" or y.status == "actionline_lppassigned" or y.status == "actionline_inprogress" or y.status == "none_available_action":
|
||
if str(y.translated_script.nondial_dest_language) == str(
|
||
y.translated_script.dial_dest_language) and str(y.translated_script.script_link_id.nondial_src_language) == str(y.translated_script.script_link_id.dial_src_language):
|
||
y.assignedlpp_action = MNFLPPDDatabase.objects.get(
|
||
lpp_id=lpp_id)
|
||
y.status = "actionline_lppassigned"
|
||
y.usernote = "Kindly check if the translated 'ACTION LINES' and 'DIALOGUE LINES' are correct as per the Uploaded Document!"
|
||
y.date_task_assigned = datetime.now()
|
||
z = y.eligiblelpp_dialogue.all()
|
||
if MNFLPPDDatabase.objects.get(lpp_id=lpp_id) in list(z):
|
||
y.eligiblelpp_dialogue.remove(
|
||
MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
)
|
||
y.save()
|
||
current_user = MNFLPPDDatabase.objects.get(lpp_id=id)
|
||
y = (
|
||
LPPTASKDatabase.objects.exclude(status="completed")
|
||
.exclude(assignedlpp_action=current_user)
|
||
.exclude(assignedlpp_dialogue=current_user)
|
||
)
|
||
new_lpp = MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
to = new_lpp.lpp_email
|
||
key_value = {
|
||
"User": new_lpp.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
|
||
context = {"data": y, "lpp_id": id}
|
||
|
||
|
||
return render(request, "lpp/manualtask.html", context)
|
||
|
||
y.assignedlpp_action = MNFLPPDDatabase.objects.get(
|
||
lpp_id=lpp_id)
|
||
y.lppacceptancetime_action = None
|
||
y.deadlinetolpp_action = None
|
||
y.date_task_assigned = datetime.now()
|
||
y.status = "actionline_lppassigned"
|
||
z = y.eligiblelpp_action.all()
|
||
if MNFLPPDDatabase.objects.get(lpp_id=lpp_id) in list(z):
|
||
y.eligiblelpp_action.remove(
|
||
MNFLPPDDatabase.objects.get(lpp_id=lpp_id))
|
||
new_lpp = MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
to = new_lpp.lpp_email
|
||
key_value = {
|
||
"User": new_lpp.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
elif y.status == "actionline_completed" or y.status == "dialogue_lppassigned" or\
|
||
y.status == "dialogue_inprogress" or y.status == "none_available_dialogue":
|
||
y.assignedlpp_dialogue = MNFLPPDDatabase.objects.get(
|
||
lpp_id=lpp_id)
|
||
y.date_task_assigned = datetime.now()
|
||
y.lppacceptancetime_dialogue = None
|
||
y.deadlinetolpp_dialogue = None
|
||
y.status = "dialogue_lppassigned"
|
||
z = y.eligiblelpp_dialogue.all()
|
||
if MNFLPPDDatabase.objects.get(lpp_id=lpp_id) in list(z):
|
||
y.eligiblelpp_dialogue.remove(
|
||
MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
)
|
||
|
||
y.save()
|
||
new_lpp = MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
# New Assigned LPP Email
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": new_lpp.first_name,
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Get to Work!",
|
||
# "heading2": "More details you can find on Dashboard",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# new_lpp.lpp_email,
|
||
# "A Task has been assigned to you",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
|
||
to = new_lpp.lpp_email
|
||
key_value = {
|
||
"User": new_lpp.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
# elif y.translated_subtitle:
|
||
# if y.status == "" or y.status == "subtitle_lppassigned" or\
|
||
# y.status == "subtitle_vetting_inprogress" or y.status == "none_available_lpp":
|
||
# y.assignedlpp_dialogue = MNFLPPDDatabase.objects.get(
|
||
# lpp_id=lpp_id)
|
||
# y.date_task_assigned = datetime.now()
|
||
# y.lppacceptancetime_dialogue = None
|
||
# y.deadlinetolpp_dialogue = None
|
||
# y.status = "subtitle_lppassigned"
|
||
# z = y.eligiblelpp_dialogue.all()
|
||
# if MNFLPPDDatabase.objects.get(lpp_id=lpp_id) in list(z):
|
||
# y.eligiblelpp_dialogue.remove(
|
||
# MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
# )
|
||
# y.save()
|
||
# new_lpp = MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
# # New Assigned LPP Email
|
||
# # with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# # body = f.read()
|
||
# # context_email = {
|
||
# # "Date": date.today(),
|
||
# # "Name": new_lpp.first_name,
|
||
# # "emailcode": "LPP101",
|
||
# # "heading1": "Get to Work!",
|
||
# # "heading2": "More details you can find on Dashboard",
|
||
# # "body": body,
|
||
# # }
|
||
# # # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# # sendemail(
|
||
# # new_lpp.lpp_email,
|
||
# # "A Task has been assigned to you",
|
||
# # date.today(),
|
||
# # context_email,
|
||
# # EMAIL_HOST_USER,
|
||
# # ).start()
|
||
#
|
||
# new_lpp = MNFLPPDDatabase.objects.get(lpp_id=lpp_id)
|
||
# to = new_lpp.lpp_email
|
||
# key_value = {
|
||
# "User": new_lpp.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP3", key_value=key_value)
|
||
|
||
if not id:
|
||
return True
|
||
else:
|
||
possible_assignable_tasks = get_possible_tasks(lpp_id=id)
|
||
context = {"data": possible_assignable_tasks, "lpp_id": id}
|
||
return render(request, "lpp/manualtask.html", context)
|
||
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def query_email(request):
|
||
subj = request.POST.get("subj")
|
||
content = request.POST.get("content")
|
||
print("sending mail 99999")
|
||
if request.POST.get("frompage") == "regform":
|
||
print("sending email minor")
|
||
to = settings.EMAIL_HOST_USER
|
||
key_value = {
|
||
"User":"Admin",
|
||
"User_email_id":request.user.email,
|
||
"subject":subj,
|
||
"content":content
|
||
}
|
||
sendmail(to_email=[to], email_code="ID1", key_value=key_value)
|
||
elif request.POST.get("frompage") == "majortable":
|
||
print("sending email major")
|
||
print(request.POST.get("lpp_id"))
|
||
to = MNFLPPDDatabase.objects.get(lpp_id=request.POST.get("lpp_id")).lpp_email
|
||
key_value = {
|
||
"User": MNFLPPDDatabase.objects.get(lpp_id=request.POST.get("lpp_id")).user_id.username,
|
||
"subject":subj,
|
||
"content": content
|
||
}
|
||
sendmail(to_email=[to], email_code="ID17", key_value=key_value)
|
||
# msg = EmailMultiAlternatives(subj, content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
# print(subj)
|
||
# print(content)
|
||
|
||
return JsonResponse({"Success": "Done"})
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def edit_details_lpp(request):
|
||
if request.method == "POST":
|
||
if not os.path.exists(f'{basepath}/media/lpp_documents'):
|
||
os.makedirs(f'{basepath}/media/lpp_documents', mode=0o777)
|
||
change_critical = False
|
||
lpp = MNFLPPDDatabase.objects.get(lpp_id=str(request.POST.get("id")), user_id = request.user)
|
||
if request.POST.get("lpp_email_new") != "":
|
||
if lpp.lpp_email == request.POST.get("lpp_email_new"):
|
||
pass
|
||
else:
|
||
lpp.lpp_email = request.POST.get("lpp_email_new")
|
||
|
||
if request.POST.get("contact_edit_counter") == "No":
|
||
lpp.countryCode = request.POST.get("code_edit")
|
||
lpp.contact = request.POST.get("number_edit")
|
||
|
||
country_json_file = open(
|
||
rf"/{basepath}/MNF/json_keys/countriesnew.json")
|
||
data_json = json.load(country_json_file)
|
||
count = 0
|
||
for i in data_json:
|
||
if i["abbr2"].lower() == request.POST.get("country_Edit"):
|
||
countryy = i["name"]
|
||
count += 1
|
||
if count == 0:
|
||
countryy = request.POST.get("country_Edit")
|
||
|
||
if request.POST.get("country_Edit") == "" or request.POST.get("country_Edit") == None:
|
||
pass
|
||
else:
|
||
if countryy != lpp.country:
|
||
lpp.country = countryy
|
||
lpp.province = request.POST.get("province_Edit")
|
||
if request.POST.get("city_Edit") == "" or request.POST.get("city_Edit") == None:
|
||
lpp.city = "N/A"
|
||
else:
|
||
lpp.city = request.POST.get("city_Edit")
|
||
elif countryy == lpp.country:
|
||
if request.POST.get("province_Edit") == "" or request.POST.get("province_Edit") == None:
|
||
pass
|
||
else:
|
||
if request.POST.get("province_Edit") != lpp.province:
|
||
lpp.province = request.POST.get("province_Edit")
|
||
else:
|
||
if request.POST.get("city_Edit") == "" or request.POST.get("city_Edit") == None:
|
||
pass
|
||
else:
|
||
if lpp.city == "" or lpp.city == "N/A" or lpp.city == None:
|
||
lpp.city = request.POST.get("city_Edit")
|
||
else:
|
||
if request.POST.get("city_Edit") != lpp.city:
|
||
lpp.city = request.POST.get("city_Edit")
|
||
|
||
if request.POST.get("lpp_sl_ql_select_edit") != lpp.firstLangDegree:
|
||
if request.POST.get("lpp_sl_ql_select_edit") == "text":
|
||
change_critical = True
|
||
lpp.firstLangDegree = request.POST.get(
|
||
"lpp_sl_ql_select_edit_text")
|
||
else:
|
||
if request.POST.get("lpp_sl_ql_select_edit") == "" or request.POST.get("lpp_sl_ql_select_edit") == "N/A":
|
||
pass
|
||
else:
|
||
change_critical = True
|
||
lpp.firstLangDegree = request.POST.get(
|
||
"lpp_sl_ql_select_edit")
|
||
|
||
if lpp.choice13 == True:
|
||
if lpp.firstLangMedium == "" or lpp.firstLangMedium == None or lpp.firstLangMedium == "N/A":
|
||
change_critical = True
|
||
lpp.firstLangMedium = request.POST.get("lpp_sl_medium_edit")
|
||
else:
|
||
if lpp.firstLangMedium != request.POST.get("lpp_sl_medium_edit"):
|
||
change_critical = True
|
||
lpp.firstLangMedium = request.POST.get(
|
||
"lpp_sl_medium_edit")
|
||
|
||
if lpp.firstLangAwardedBy != request.POST.get("lpp_sl_ql_c_edit"):
|
||
lpp.firstLangAwardedBy = request.POST.get("lpp_sl_ql_c_edit")
|
||
|
||
if str(lpp.firstLangDegreeFile) != "":
|
||
try:
|
||
if str(request.FILES["degree_sl"]) != "":
|
||
if str(lpp.firstLangDegreeFile) != str(request.FILES["degree_sl"]):
|
||
change_critical = True
|
||
lpp.firstLangDegreeFile.delete()
|
||
lpp.firstLangDegreeFile = request.FILES["degree_sl"]
|
||
except:
|
||
pass
|
||
else:
|
||
try:
|
||
change_critical = True
|
||
lpp.firstLangDegreeFile = request.FILES["degree_sl"]
|
||
except:
|
||
pass
|
||
|
||
if request.POST.get("lpp_tl_ql_select_edit") != lpp.secondLangDegree:
|
||
if request.POST.get("lpp_tl_ql_select_edit") == "text":
|
||
change_critical = True
|
||
lpp.secondLangDegree = request.POST.get(
|
||
"lpp_tl_ql_select_edit_text")
|
||
else:
|
||
if request.POST.get("lpp_tl_ql_select_edit") == "" or request.POST.get("lpp_tl_ql_select_edit") == "N/A":
|
||
pass
|
||
else:
|
||
change_critical = True
|
||
lpp.secondLangDegree = request.POST.get(
|
||
"lpp_tl_ql_select_edit")
|
||
|
||
if lpp.choice23 == True:
|
||
if lpp.secondLangMedium == "" or lpp.secondLangMedium == None or lpp.secondLangMedium == "N/A":
|
||
change_critical = True
|
||
lpp.secondLangMedium = request.POST.get("lpp_tl_medium_edit")
|
||
else:
|
||
if lpp.secondLangMedium != request.POST.get("lpp_tl_medium_edit"):
|
||
change_critical = True
|
||
lpp.secondLangMedium = request.POST.get(
|
||
"lpp_tl_medium_edit")
|
||
|
||
if lpp.secondLangAwardedBy != request.POST.get("lpp_tl_ql_c_edit"):
|
||
lpp.secondLangAwardedBy = request.POST.get("lpp_tl_ql_c_edit")
|
||
|
||
if str(lpp.secondLangDegreeFile) != "":
|
||
try:
|
||
if str(request.FILES["degree_tl"]) != "":
|
||
if str(lpp.secondLangDegreeFile) != str(request.FILES["degree_tl"]):
|
||
change_critical = True
|
||
lpp.secondLangDegreeFile.delete()
|
||
lpp.secondLangDegreeFile = request.FILES["degree_tl"]
|
||
except:
|
||
pass
|
||
else:
|
||
try:
|
||
change_critical = True
|
||
lpp.secondLangDegreeFile = request.FILES["degree_tl"]
|
||
except:
|
||
pass
|
||
|
||
if lpp.certificationL1L2 != request.POST.get("lpp_sl_tl_select_edit"):
|
||
if request.POST.get("lpp_sl_tl_select_edit") == "Others":
|
||
if request.POST.get("lpp_sl_tl_select_edit") == "":
|
||
pass
|
||
else:
|
||
change_critical = True
|
||
lpp.certificationL1L2 = request.POST.get(
|
||
"lpp_sl_tl_select_edit_text")
|
||
else:
|
||
if request.POST.get("lpp_sl_tl_select_edit") == "":
|
||
pass
|
||
else:
|
||
change_critical = True
|
||
lpp.certificationL1L2 = request.POST.get(
|
||
"lpp_sl_tl_select_edit")
|
||
|
||
if lpp.certttificationAwardedByL1L2 != '':
|
||
try:
|
||
if lpp.certttificationAwardedByL1L2 != request.POST.get("lpp_sl_tl_a_edit"):
|
||
lpp.certttificationAwardedByL1L2 = request.POST.get(
|
||
"lpp_sl_tl_a_edit")
|
||
except:
|
||
pass
|
||
else:
|
||
try:
|
||
lpp.certttificationAwardedByL1L2 = request.POST.get(
|
||
"lpp_sl_tl_a_edit")
|
||
except:
|
||
pass
|
||
|
||
if lpp.durationCertificationL1L2 != request.POST.get("lpp_sl_tl_d_select_edit"):
|
||
if request.POST.get("lpp_sl_tl_d_select_edit") == "":
|
||
pass
|
||
else:
|
||
change_critical = True
|
||
lpp.durationCertificationL1L2 = request.POST.get(
|
||
"lpp_sl_tl_d_select_edit")
|
||
|
||
if lpp.modeCertificationL1L2 != "":
|
||
if lpp.modeCertificationL1L2 != request.POST.get("modeCertificationL1L2"):
|
||
lpp.modeCertificationL1L2 = request.POST.get(
|
||
"modeCertificationL1L2")
|
||
else:
|
||
lpp.modeCertificationL1L2 = request.POST.get(
|
||
"modeCertificationL1L2")
|
||
|
||
if lpp.certificationFile != '':
|
||
try:
|
||
if request.FILES["degree_sl_tl_c"] != "":
|
||
if lpp.certificationFile != request.FILES["degree_sl_tl_c"]:
|
||
change_critical = True
|
||
lpp.certificationFile.delete()
|
||
lpp.certificationFile = request.FILES["degree_sl_tl_c"]
|
||
except:
|
||
pass
|
||
|
||
else:
|
||
try:
|
||
change_critical = True
|
||
lpp.certificationFile = request.FILES["degree_sl_tl_c"]
|
||
except:
|
||
pass
|
||
|
||
if lpp.expFirstLang == "20":
|
||
pass
|
||
else:
|
||
if lpp.expFirstLang != "":
|
||
if lpp.expFirstLang != request.POST.get("lpp_sl_exp"):
|
||
change_critical = True
|
||
lpp.expFirstLang = request.POST.get("lpp_sl_exp")
|
||
if lpp.expSecondLang == "20":
|
||
pass
|
||
else:
|
||
if lpp.expSecondLang != "":
|
||
if lpp.expSecondLang != request.POST.get("lpp_tl_exp"):
|
||
change_critical = True
|
||
lpp.expSecondLang = request.POST.get("lpp_tl_exp")
|
||
if lpp.scriptWrittenFirstLang == "moreThan100":
|
||
pass
|
||
else:
|
||
if lpp.scriptWrittenFirstLang != '':
|
||
if lpp.scriptWrittenFirstLang != request.POST.get("lpp_sl_exp_w_n"):
|
||
change_critical = True
|
||
lpp.scriptWrittenFirstLang = request.POST.get(
|
||
"lpp_sl_exp_w_n")
|
||
if request.POST.get("lpp_sl_exp_w_n_text") != "":
|
||
lpp.scriptWrittenFirstLangLink = request.POST.get(
|
||
"lpp_sl_exp_w_n_text")
|
||
|
||
if lpp.scriptWrittenSecondLang == "moreThan100":
|
||
pass
|
||
else:
|
||
if lpp.scriptWrittenSecondLang != '':
|
||
if lpp.scriptWrittenSecondLang != request.POST.get("lpp_tl_exp_w_n"):
|
||
change_critical = True
|
||
lpp.scriptWrittenSecondLang = request.POST.get(
|
||
"lpp_tl_exp_w_n")
|
||
|
||
if request.POST.get("lpp_tl_exp_w_n_text") != "":
|
||
lpp.scriptWrittenSecondLangLink = request.POST.get(
|
||
"lpp_tl_exp_w_n_text")
|
||
|
||
if lpp.noScriptTransFromL1toL2 == "moreThan100":
|
||
pass
|
||
else:
|
||
if lpp.noScriptTransFromL1toL2 != '':
|
||
if lpp.noScriptTransFromL1toL2 != request.POST.get("lpp_sl_exp_s_n"):
|
||
change_critical = True
|
||
lpp.noScriptTransFromL1toL2 = request.POST.get(
|
||
"lpp_sl_exp_s_n")
|
||
|
||
if request.POST.get("lpp_sl_exp_s_n_text") != "":
|
||
lpp.noScriptTransFromL1toL2Link = request.POST.get(
|
||
"lpp_sl_exp_s_n_text")
|
||
|
||
if lpp.noScriptTransFromL2toL1 == "moreThan100":
|
||
pass
|
||
else:
|
||
if lpp.noScriptTransFromL2toL1 != '':
|
||
if lpp.noScriptTransFromL2toL1 != request.POST.get("lpp_tl_exp_s_n"):
|
||
change_critical = True
|
||
lpp.noScriptTransFromL2toL1 = request.POST.get(
|
||
"lpp_tl_exp_s_n")
|
||
|
||
if request.POST.get("lpp_tl_exp_s_n_text") != "":
|
||
lpp.noScriptTransFromL2toL1Link = request.POST.get(
|
||
"lpp_tl_exp_s_n_text")
|
||
|
||
if lpp.noArticleTransFromL1toL2 == "moreThan100":
|
||
pass
|
||
else:
|
||
if lpp.noArticleTransFromL1toL2 != '':
|
||
if lpp.noArticleTransFromL1toL2 != request.POST.get("lpp_sl_exp_a_n"):
|
||
change_critical = True
|
||
lpp.noArticleTransFromL1toL2 = request.POST.get(
|
||
"lpp_sl_exp_a_n")
|
||
|
||
if request.POST.get("lpp_sl_exp_a_n_text") != "":
|
||
lpp.noArticleTransFromL1toL2Link = request.POST.get(
|
||
"lpp_sl_exp_a_n_text")
|
||
|
||
if lpp.noArticleTransFromL2toL1 == "moreThan100":
|
||
pass
|
||
else:
|
||
if lpp.noArticleTransFromL2toL1 != '':
|
||
if lpp.noArticleTransFromL2toL1 != request.POST.get("lpp_tl_exp_a_n"):
|
||
change_critical = True
|
||
lpp.noArticleTransFromL2toL1 = request.POST.get(
|
||
"lpp_tl_exp_a_n")
|
||
|
||
if request.POST.get("lpp_tl_exp_a_n_text") != "":
|
||
lpp.noArticleTransFromL2toL1Link = request.POST.get(
|
||
"lpp_tl_exp_a_n_text")
|
||
|
||
if change_critical == True:
|
||
|
||
lpp.status = "Shortlisted"
|
||
|
||
# TO ADMIN
|
||
to = settings.EMAIL_HOST_USER
|
||
key_value = {
|
||
"User": "Admin",
|
||
"lpp_id": str(lpp.lpp_id)
|
||
}
|
||
sendmail(to_email=[to], email_code="ID13", key_value=key_value)
|
||
|
||
|
||
# subject = "A LPP has made a change in their crucial details!"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
#
|
||
# to = settings.EMAIL_HOST_USER
|
||
#
|
||
# context = {"Date": date.today(), "Name": lpp.user_id.first_name}
|
||
#
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/ideamall/templates/ideamall/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# print("5777777777777777777777777777777777777777777777777777777777777777777")
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
# TO LPP
|
||
to = lpp.lpp_email
|
||
key_value = {
|
||
"User": lpp.user_id.username
|
||
}
|
||
sendmail(to_email=[to], email_code="ID12", key_value=key_value)
|
||
|
||
|
||
# subject = "Thanks for editing! Your application is under review"
|
||
# from_email = settings.EMAIL_HOST_USER
|
||
#
|
||
# to = lpp.lpp_email
|
||
#
|
||
# context = {"Date": date.today(), "Name": lpp.user_id.first_name}
|
||
#
|
||
# html_content = render_to_string(
|
||
# rf"{basepath}/ideamall/templates/ideamall/email_templete.html",
|
||
# context, # /home/user/mnf/project/MNF/ideamall/templates/ideamall/email_templete.html
|
||
# ) # render with dynamic value
|
||
# # Strip the html tag. So people can see the pure text at least.
|
||
# text_content = strip_tags(html_content)
|
||
# # create the email, and attach the HTML version as well.
|
||
# msg = EmailMultiAlternatives(
|
||
# subject, text_content, from_email, [to])
|
||
# msg.attach_alternative(html_content, "text/html")
|
||
# msg.send()
|
||
|
||
lpp.save()
|
||
|
||
return redirect('majorTable', id=str(request.POST.get("id")), mode="view")
|
||
|
||
#
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def lpp_comment(request):
|
||
x = LPPTASKDatabase.objects.get(task_id=request.POST.get("get_taskid"))
|
||
if x.assignedlpp_action.user_id.email == request.user.email:
|
||
x.lpp_action_comment = request.POST.get("lpp_comment")
|
||
else:
|
||
x.lpp_dialogue_comment = request.POST.get("lpp_comment")
|
||
x.save()
|
||
|
||
# -> Sending mail regarding lpp's comment to user
|
||
to = x.translated_script.user_id.email
|
||
key_value = {
|
||
"User": x.translated_script.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP16", key_value=key_value)
|
||
|
||
return redirect("lpptask_dashboard")
|
||
#
|
||
#
|
||
# @login_required(login_url="/PersonalLogin-2")
|
||
# def lpp_comment_ppt(request):
|
||
# x = LPPTASKDatabase.objects.get(task_id=request.POST.get("get_taskid"))
|
||
# x.lpp_dialogue_comment = request.POST.get("lpp_comment2")
|
||
# x.save()
|
||
#
|
||
# # -> Sending mail regarding lpp's comment to user
|
||
# to = x.translated_ppt.user_id.email
|
||
# key_value = {
|
||
# "User": x.translated_ppt.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP16", key_value=key_value)
|
||
#
|
||
# return redirect("lpptask_dashboard")
|
||
#
|
||
|
||
# @login_required(login_url="/PersonalLogin-2")
|
||
# def lpp_comment_subtitle(request):
|
||
# x = LPPTASKDatabase.objects.get(task_id=request.POST.get("get_taskid"))
|
||
# x.lpp_dialogue_comment = request.POST.get("lpp_comment200")
|
||
# x.save()
|
||
#
|
||
# # -> Sending mail regarding lpp's comment to user
|
||
# to = x.translated_subtitle.user.email
|
||
# key_value = {
|
||
# "User": x.translated_subtitle.user.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP16", key_value=key_value)
|
||
#
|
||
# return redirect("lpptask_dashboard")
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def delete_task(request, id):
|
||
if request.user.is_superuser:
|
||
print("delete_task function called")
|
||
task = LPPTASKDatabase.objects.get(task_id=id)
|
||
print("task found")
|
||
# send mail to end usr that we are unable to find lpp
|
||
# with open(rf"{basepath}/lpp/templates/lpp/body.txt") as f:
|
||
# body = f.read()
|
||
#
|
||
# context_email = {
|
||
# "Date": date.today(),
|
||
# "Name": task.user_id.first_name,
|
||
# "emailcode": "LPP101",
|
||
# "heading1": "Sorry but our Language experts are Unavailable!!!",
|
||
# "heading2": "You can check Machine Output and you will get your refund back shortly",
|
||
# "body": body,
|
||
# }
|
||
# # whomtosend, titleofmail, dateofemail, context, EMAIL_HOST_USER
|
||
# sendemail(
|
||
# task.user_id.email,
|
||
# "LPP Not Available! Refund Initiated",
|
||
# date.today(),
|
||
# context_email,
|
||
# EMAIL_HOST_USER,
|
||
# ).start()
|
||
|
||
|
||
print("Mail thread started")
|
||
# end user will see machine translation
|
||
# auto handled during deletion of Task
|
||
|
||
# end user recieve
|
||
# payment_intent_id = task.translated_script.payment_intent_id
|
||
# print("Found the intent id: ", payment_intent_id)
|
||
# if payment_intent_id:
|
||
# print("Went into if condition")
|
||
# total_amount = float(task.amoutgiventolpp_action) * 2
|
||
# print("Amount to refund: ", total_amount)
|
||
#
|
||
# # try:
|
||
# # c = CurrencyRates()
|
||
# # rate = c.get_rate("USD", "INR")
|
||
# # except Exception as e:
|
||
# # print("LPP REFUND ERROR", e)
|
||
# # rate = 80
|
||
# with open(f'{basepath}/MNF/json_keys/conversionRates.json') as c:
|
||
# curr = json.load(c)
|
||
#
|
||
# print(curr['rates']['INR'],
|
||
# " : Current conversion rate of USD to INR")
|
||
#
|
||
# try:
|
||
# rate = curr['rates']['INR']
|
||
# print(rate, " : Latest rates 30sep")
|
||
# # c = CurrencyRates()
|
||
# # rate = c.get_rate("USD", str(currency.upper()))
|
||
# except Exception as e:
|
||
# print("checkout error", e)
|
||
# rate = 80
|
||
#
|
||
# payment_amount = int(total_amount * 100 * rate)
|
||
# print("Amount converted to INR: ", payment_amount)
|
||
# if payment_intent_id[0:3] == "pay":
|
||
# client = razorpay.Client(auth=(keyID, keySecret))
|
||
# payment_id = payment_intent_id
|
||
# paydetail = client.payment.fetch(payment_id)
|
||
#
|
||
# client.payment.refund(
|
||
# payment_id, {"amount": payment_amount, "speed": "normal", })
|
||
# else:
|
||
# # MUST TEST THOROUGHLY
|
||
# stripe.Refund.create(
|
||
# payment_intent=payment_intent_id, amount=payment_amount)
|
||
|
||
|
||
|
||
# -> Sending Mail to User alerting him about that his task is rejected and refund is inititated
|
||
if task.translated_script:
|
||
email1 = task.translated_script.user_id.email
|
||
username1 = task.translated_script.user_id.username
|
||
# -> refund using central payment
|
||
amt1 = float(task.amoutgiventolpp_action)
|
||
amt2 = float(task.amoutgiventolpp_dialogue)
|
||
auto_refund(task.translated_script.central_payment_id, amt1 + amt2)
|
||
|
||
print("Amount refunded")
|
||
# elif task.translated_ppt:
|
||
# email1 = task.translated_ppt.user_id.email
|
||
# username1 = task.translated_ppt.user_id.username
|
||
# # -> refund using central payment
|
||
# amt1 = 0
|
||
# amt2 = float(task.amoutgiventolpp_dialogue)
|
||
# auto_refund(task.translated_ppt.central_payment_id, amt1 + amt2)
|
||
# elif task.translated_subtitle:
|
||
# email1 = task.translated_subtitle.user.email
|
||
# username1 = task.translated_subtitle.user.username
|
||
# # -> refund using central payment
|
||
# amt1 = 0
|
||
# amt2 = float(task.amoutgiventolpp_dialogue)
|
||
# auto_refund(task.translated_subtitle.cp_id, amt1 + amt2)
|
||
to = email1
|
||
key_value = {
|
||
"User": username1,
|
||
}
|
||
sendmail(to_email=[to], email_code="ID24", key_value=key_value)
|
||
|
||
# deleting task
|
||
task.delete()
|
||
print("Task deleted")
|
||
|
||
return redirect("admin_dashboard")
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def lpp_task_earning(request):
|
||
if request.user.is_superuser:
|
||
if request.method == "POST":
|
||
lpp = MNFLPPDDatabase.objects.get(lpp_id=str(request.POST.get("id")))
|
||
lpp.lpp_task_balance = float(Decimal(
|
||
str(lpp.lpp_task_balance))) - float(Decimal(str(request.POST.get("transfer_amount"))))
|
||
|
||
|
||
lpp.lpp_withdraw_request = False
|
||
lpp.lpp_withdraw_amount = 0.00
|
||
lpp.save()
|
||
# Central Wallet Deduction
|
||
central_wallet = Wallet.objects.get(
|
||
user=lpp.user_id)
|
||
central_wallet.balance = float(
|
||
central_wallet.balance) - float(Decimal(str(request.POST.get("transfer_amount"))))
|
||
central_wallet.lpp_balance = float(
|
||
central_wallet.lpp_balance) + float(Decimal(str(request.POST.get("transfer_amount"))))
|
||
central_wallet.save()
|
||
|
||
#Rm Database Upation
|
||
# rm_Databse = RMDatabase.objects.get(user_id = lpp.user_id)
|
||
# rm_Databse.balance = float(central_wallet.balance)
|
||
# rm_Databse.save()
|
||
|
||
# -> Alerting Lpp about his payment
|
||
to = lpp.lpp_email
|
||
key_value = {
|
||
"User": lpp.user_id.username,
|
||
"X": str(float(Decimal(str(request.POST.get("transfer_amount")))))
|
||
}
|
||
|
||
|
||
sendmail(to_email=[to], email_code="ID20", key_value=key_value)
|
||
|
||
return redirect('minortable')
|
||
|
||
|
||
@login_required(login_url="/PersonalLogin-2")
|
||
def getUserDataforRhm(request):
|
||
context = {}
|
||
if request.method == "GET":
|
||
try:
|
||
lpp = MNFLPPDDatabase.objects.get(user_id=request.user)
|
||
context["User"] = serializers.serialize('python', [lpp])[
|
||
0]['fields']
|
||
context["isLPP"] = True
|
||
except:
|
||
context["User"] = "Do not Exist"
|
||
context["isLPP"] = False
|
||
|
||
if context["User"] != "Do not Exist":
|
||
context["isAccepted"] = True if lpp.status == "Selected" else False
|
||
if context["isAccepted"]:
|
||
context["ApprovedOn"] = lpp.approved_on
|
||
context["AssignmentsCompleted"] = lpp.no_task_completed
|
||
count_pendingwork = LPPTASKDatabase.objects.filter(
|
||
Q(assignedlpp_action=lpp.lpp_id) | Q(
|
||
assignedlpp_dialogue=lpp.lpp_id)).exclude(status="completed").exclude(status="none_available_dialogue")
|
||
print("yahi hai", count_pendingwork)
|
||
context["NumberOfPendingScripts"] = count_pendingwork.filter(
|
||
translated_script__isnull=False).filter(Q(lppacceptancetime_action__isnull=False) | Q(lppacceptancetime_action__isnull=False)).count()
|
||
# context["NumberOfPendingPPT"] = count_pendingwork.filter(
|
||
# translated_ppt__isnull=False, lppacceptancetime_dialogue__isnull=False).count()
|
||
# context["NumberOfPendingSubtitle"] = count_pendingwork.filter(
|
||
# translated_subtitle__isnull=False, lppacceptancetime_dialogue__isnull=False).count()
|
||
# pending_scripts = count_pendingwork.filter(
|
||
# translated_script__isnull=False).filter(Q(lppacceptancetime_action__isnull=False) | Q(lppacceptancetime_action__isnull=False))
|
||
# print("ye hai pending scripts", pending_scripts)
|
||
# context["AllPendingScripts"] = serializers.serialize(
|
||
# 'python', list(pending_scripts))
|
||
# pending_ppts = count_pendingwork.filter(
|
||
# translated_ppt__isnull=False, lppacceptancetime_dialogue__isnull=False)
|
||
# context["AllPendingPPT"] = serializers.serialize(
|
||
# 'python', list(pending_ppts))
|
||
# pending_subtitles = count_pendingwork.filter(
|
||
# translated_subtitle__isnull=False, lppacceptancetime_dialogue__isnull=False)
|
||
# context["AllPendingSubtitle"] = serializers.serialize(
|
||
# 'python', list(pending_subtitles))
|
||
# context["NumberOfPagesOnPendingScripts"] = [int(
|
||
# x.translated_script.script_link_id.numPages) for x in pending_scripts if x.translated_script.script_link_id.numPages > 0]
|
||
# context["NumberOfSlidesOnPendingPPT"] = [int(
|
||
# x.translated_ppt.slide_count) for x in pending_ppts if x.translated_ppt.slide_count > 0]
|
||
# context["NumberOfMinsOnPendingSubtitle"] = [
|
||
# int(x.translated_subtitle.subtitles_id.video_duration)
|
||
# if x.translated_subtitle and x.translated_subtitle.subtitles_id.video_duration and x.translated_subtitle.subtitles_id.video_duration > 0
|
||
# else 0
|
||
# for x in pending_subtitles
|
||
# ]
|
||
|
||
'''
|
||
# manoj changes
|
||
|
||
'''
|
||
# dataName = []
|
||
# for x in pending_scripts:
|
||
# try:
|
||
# s = str(x.translated_script.script_link_id.script_title)
|
||
# if s:
|
||
# s = s[8:]
|
||
# s = s.split('_')
|
||
# s = "_".join(s[:-1])
|
||
# dataName.append(s)
|
||
# else:
|
||
# dataName.append("script00"+str(randint(1, 100)))
|
||
# except:
|
||
# dataName.append("script00"+str(randint(1, 100)))
|
||
# context["NameOfPendingScripts"] = dataName
|
||
#
|
||
# dataName = []
|
||
# for x in pending_ppts:
|
||
# try:
|
||
# s = str(x.translated_ppt.upload_ppt)
|
||
# if s:
|
||
# s = s[13:]
|
||
# s = s.split('_')
|
||
# s = "_".join(s[:-1])
|
||
# dataName.append(s)
|
||
# else:
|
||
# dataName.append("ppt00"+str(randint(1, 100)))
|
||
# except:
|
||
# dataName.append("ppt00"+str(randint(1, 100)))
|
||
#
|
||
# context["NameOfPendingPPT"] = dataName
|
||
#
|
||
# # dataName = []
|
||
# # for x in pending_subtitles:
|
||
# # try:
|
||
# # s = str(x.translated_subtitles.subtitles_id.project_name)
|
||
# # if s:
|
||
# # dataName.append(s)
|
||
# # else:
|
||
# # dataName.append("subtitle00"+str(randint(1, 100)))
|
||
# # except:
|
||
# # dataName.append("subtitle00"+str(randint(1, 100)))
|
||
# #
|
||
# # context["NameOfPendingSubtitle"] = dataName
|
||
#
|
||
# # hours = dt.seconds / 60 / 60
|
||
# # context["DurationOnPendingSubtitle"] = [int(x.translated_subtitle.video_duration) for x in count_pendingwork.filter(translated_subtitle__isnull=False) if x.translated_subtitle.video_duration > 0]
|
||
# data1 = []
|
||
# for x in count_pendingwork.filter(translated_script__isnull=False):
|
||
# if x.deadlinetolpp_action and x.assignedlpp_action.user_id.email == request.user.email:
|
||
# data1.append(math.ceil(
|
||
# (((x.deadlinetolpp_action - timezone.now()).total_seconds()) / 60 / 60)/24))
|
||
# elif x.deadlinetolpp_dialogue and x.assignedlpp_dialogue.user_id.email == request.user.email:
|
||
# data1.append(math.ceil(
|
||
# (((x.deadlinetolpp_dialogue - timezone.now()).total_seconds()) / 60 / 60)/24))
|
||
#
|
||
# context["NumberOfDaysOnPendingScripts"] = data1
|
||
# data1 = []
|
||
# for x in count_pendingwork.filter(translated_ppt__isnull=False):
|
||
# if x.lppacceptancetime_dialogue:
|
||
# data1.append(math.ceil(
|
||
# (((x.deadlinetolpp_dialogue - timezone.now()).total_seconds()) / 60 / 60)/24))
|
||
#
|
||
# context["NumberOfDaysOnPendingPPT"] = data1
|
||
# data1 = []
|
||
# for x in count_pendingwork.filter(translated_subtitle__isnull=False):
|
||
# if x.lppacceptancetime_dialogue:
|
||
# data1.append(math.ceil(
|
||
# (((x.deadlinetolpp_dialogue - timezone.now()).total_seconds()) / 60 / 60)/24))
|
||
#
|
||
# context["NumberOfDaysOnPendingSubtitle"] = data1
|
||
return JsonResponse(context)
|
||
|
||
# sample output
|
||
# {
|
||
# "User": queryset(), # assume that user is always loggedin
|
||
# "ApprovedOn": dd-mm-yyyy,
|
||
# "AssignmentsCompleted": 57,
|
||
# "NumberOfPendingScripts":12,
|
||
# "NumberOfPendingPPT": 12,
|
||
# "NumberOfPendingSubtitle":12,
|
||
# "AllPendingScripts": queryset([]),
|
||
# "AllPendingPPT": queryset([]),
|
||
# "AllPendingSubtitle": queryset([]),
|
||
# "NumberOfPagesOnPendingScripts" : [2,5,3,6,8,4,5,6], #order should be same as AllPendingScripts
|
||
# "NumberOfPagesOnPendingPPT" : [2,5,3,6,8,4,5,6], #same
|
||
# "NumberOfPagesOnPendingSubtitle" : [2,5,3,6,8,4,5,6], #same
|
||
# "NumberOfDaysOnPendingScripts" : [2,5,3,6,8,4,5,6], #order should be same as AllPendingScripts
|
||
# "NumberOfDaysOnPendingPPT" : [2,5,3,6,8,4,5,6], #same
|
||
# "NumberOfDaysOnPendingSubtitle" : [2,5,3,6,8,4,5,6], #same
|
||
|
||
|
||
def updateAvailabity(request):
|
||
context = {}
|
||
if request.method == "PATCH":
|
||
json_data = request.body.decode('utf-8')
|
||
data = json.loads(json_data)
|
||
availability = data.get('availability')
|
||
userid = data.get('user_id')
|
||
user = User.objects.get(pk=userid)
|
||
obj = MNFLPPDDatabase.objects.get(user_id=user)
|
||
obj.availabity = availability
|
||
obj.save()
|
||
context["success"] = "updated successfully"
|
||
return JsonResponse(context)
|
||
return JsonResponse(context)
|
||
|
||
|
||
def api_update_availabity(request, availabity):
|
||
if request.method == "GET":
|
||
x = MNFLPPDDatabase.objects.get(user_id=request.user.id)
|
||
x.availabity = True if availabity == "Yes" else False
|
||
|
||
if availabity == "No":
|
||
to = x.lpp_email
|
||
key_value = {
|
||
"User": x.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="ID22", key_value=key_value)
|
||
|
||
print("Email sentttttt successfully!")
|
||
y = LPPTASKDatabase.objects.filter(Q(assignedlpp_action=MNFLPPDDatabase.objects.get(
|
||
lpp_id=x.lpp_id)) | Q(assignedlpp_dialogue=MNFLPPDDatabase.objects.get(lpp_id=x.lpp_id)))
|
||
print("Objects found!")
|
||
for item in y:
|
||
|
||
if item.status == "completed" or item.status == "actionline_completed" or item.status == "dialogue_completed" \
|
||
or item.status == "dialogue_completed" or item.status == "none_available_dialogue":
|
||
pass
|
||
else:
|
||
|
||
if item.assignedlpp_action == MNFLPPDDatabase.objects.get(lpp_id=x.lpp_id):
|
||
if str(item.translated_script.nondial_dest_language) == str(
|
||
item.translated_script.dial_dest_language) and str(
|
||
item.translated_script.script_link_id.nondial_src_language) == str(
|
||
item.translated_script.script_link_id.dial_src_language):
|
||
if len(list(item.eligiblelpp_action.all())) > 0:
|
||
reassign_task(
|
||
item.task_id, "action", "eligible")
|
||
else:
|
||
reassign_task(
|
||
item.task_id, "action", "noneligible")
|
||
if len(list(item.eligiblelpp_action.all())) > 0:
|
||
reassign_task(item.task_id, "action", "eligible")
|
||
else:
|
||
reassign_task(
|
||
item.task_id, "action", "noneligible")
|
||
elif item.assignedlpp_dialogue == MNFLPPDDatabase.objects.get(lpp_id=x.lpp_id):
|
||
if len(list(item.eligiblelpp_dialogue.all())) > 0:
|
||
reassign_task(item.task_id, "dialogue", "eligible")
|
||
else:
|
||
reassign_task(
|
||
item.task_id, "dialogue", "noneligible")
|
||
x.save()
|
||
return JsonResponse({"status":"Updated to "+ str(x.availabity)})
|
||
|
||
|
||
def Accept_Task_Possible(request):
|
||
if request.method == "POST":
|
||
task_id = request.POST.get("taskid")
|
||
task = LPPTASKDatabase.objects.get(task_id=task_id)
|
||
lpp = MNFLPPDDatabase.objects.get(user_id=request.user)
|
||
if task.translated_script:
|
||
task.assignedlpp_action = lpp
|
||
task.date_task_assigned = datetime.now()
|
||
task.status = "actionline_lppassigned"
|
||
if str(task.translated_script.nondial_dest_language) == str(task.translated_script.dial_dest_language) and str(
|
||
task.translated_script.script_link_id.nondial_src_language) == str(task.translated_script.script_link_id.dial_src_language):
|
||
task.usernote = "Kindly check if the translated 'ACTION LINES' and 'DIALOGUE LINES' are correct as per the Uploaded Document!"
|
||
else:
|
||
task.usernote = "Kindly check if the translated 'ACTION LINES' are correct as per the Uploaded Document!"
|
||
task.save()
|
||
# Send mail to assigned LPP
|
||
to = task.assignedlpp_action.lpp_email
|
||
key_value = {
|
||
"User": task.assignedlpp_action.user_id.username,
|
||
}
|
||
sendmail(to_email=[to], email_code="PP2", key_value=key_value)
|
||
|
||
# elif task.translated_ppt:
|
||
# task.assignedlpp_dialogue = lpp
|
||
# task.date_task_assigned = datetime.now()
|
||
# task.status = "dialogue_lppassigned"
|
||
# task.usernote = "Kindly check if the translated 'Text' are correct as per the Uploaded PPT!"
|
||
# task.save()
|
||
# # Send mail to assigned LPP
|
||
# to = task.assignedlpp_dialogue.lpp_email
|
||
# key_value = {
|
||
# "User": task.assignedlpp_dialogue.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP3", key_value=key_value)
|
||
|
||
# elif task.translated_subtitle:
|
||
# task.assignedlpp_dialogue = lpp
|
||
# task.date_task_assigned = datetime.now()
|
||
# task.status = "subtitle_lppassigned"
|
||
# # Translated SRT Case
|
||
# if task.translated_subtitle.subtitles_id.target_languages != "":
|
||
# task.usernote = "Kindly check if the translated 'Subtitles' are correct as per the Uploaded Video!"
|
||
# # Generated SRT Case
|
||
# else:
|
||
# task.usernote = "Kindly check if the Created 'Subtitles' are correct as per the Uploaded Video!"
|
||
# task.save()
|
||
# to = task.assignedlpp_dialogue.lpp_email
|
||
# key_value = {
|
||
# "User": task.assignedlpp_dialogue.user_id.username,
|
||
# }
|
||
# sendmail(to_email=[to], email_code="PP3", key_value=key_value)
|
||
|
||
# if task.translated_script:
|
||
# for lpp1 in task.possiblelpp_action.all():
|
||
# if lpp1 != lpp:
|
||
# task.eligiblelpp_action.add(lpp1)
|
||
# task.possiblelpp_action.remove(lpp1)
|
||
# task.save()
|
||
# else:
|
||
# for lpp1 in task.possiblelpp_dialogue.all():
|
||
# if lpp1 != lpp:
|
||
# task.eligiblelpp_dialogue.add(lpp1)
|
||
# task.possiblelpp_dialogue.remove(lpp1)
|
||
# task.save()
|
||
#
|
||
return redirect('lpptask_dashboard')
|
||
|
||
|
||
def check_if_possible_empty(task, lpp):
|
||
if task.translated_script:
|
||
for lpp1 in task.possiblelpp_action.all():
|
||
if lpp:
|
||
if lpp1 != lpp:
|
||
task.eligiblelpp_action.add(lpp1)
|
||
task.possiblelpp_action.remove(lpp1)
|
||
else:
|
||
task.eligiblelpp_action.add(lpp1)
|
||
task.possiblelpp_action.remove(lpp1)
|
||
task.save()
|
||
return True
|
||
else:
|
||
for lpp1 in task.possiblelpp_dialogue.all():
|
||
if lpp:
|
||
if lpp1 != lpp:
|
||
task.eligiblelpp_dialogue.add(lpp1)
|
||
task.eligiblelpp_dialogue.remove(lpp1)
|
||
else:
|
||
task.eligiblelpp_dialogue.add(lpp1)
|
||
task.eligiblelpp_dialogue.remove(lpp1)
|
||
task.save()
|
||
return True
|
||
|
||
return False
|
||
|
||
def lpp_withdraw(request):
|
||
|
||
if request.method == "POST":
|
||
|
||
if not request.POST.get('withdraw_amount'):
|
||
return HttpResponseBadRequest()
|
||
|
||
|
||
lpp = MNFLPPDDatabase.objects.get(user_id=request.user)
|
||
|
||
|
||
lpp.lpp_withdraw_request = True
|
||
lpp.lpp_withdraw_amount = request.POST.get('withdraw_amount')
|
||
lpp.save()
|
||
|
||
|
||
return redirect('lpptask_dashboard')
|
||
|