298 lines
12 KiB
Python
298 lines
12 KiB
Python
|
from django.db import models
|
||
|
from django.contrib.auth.models import User
|
||
|
from mnfapp.models import ScriptTranslations
|
||
|
# from conversion.models import pptconversion
|
||
|
# from subtitling3.models import Videoes
|
||
|
import os
|
||
|
import time
|
||
|
import datetime
|
||
|
import uuid
|
||
|
from MNF.settings import BasePath
|
||
|
basePath = BasePath()
|
||
|
from pathlib import Path
|
||
|
|
||
|
stat = (
|
||
|
("actionline_inprogress", "actionline_inprogress"),
|
||
|
("dialogue_inprogress", "dialogue_inprogress"),
|
||
|
("actionline_completed", "actionline_completed"),
|
||
|
("dialogue_completed", "dialogue_completed"),
|
||
|
("actionline_lppassigned", "actionline_lppassigned"),
|
||
|
("dialogue_lppassigned", "dialogue_lppassigned"),
|
||
|
("completed", "completed"),
|
||
|
("hold", "hold"),
|
||
|
("no_action_taken_bylpp", "no_action_taken_bylpp"),
|
||
|
("none_available_action", "none_available_action"),
|
||
|
("none_available_dialogue", "none_available_dialogue"),
|
||
|
("none_available_lpp", "none_available_lpp"),
|
||
|
("subtitle_vetting_inprogress", "subtitle_vetting_inprogress"),
|
||
|
("subtitle_lppassigned", "subtitle_lppassigned"),
|
||
|
("subtitle_completed", "subtitle_completed"),
|
||
|
)
|
||
|
|
||
|
gen_from = (
|
||
|
("conversion", "conversion"),
|
||
|
("onepager", "onepager"),
|
||
|
("subtitling", "subtitling"),
|
||
|
)
|
||
|
|
||
|
|
||
|
def get_file_path(instance, filename):
|
||
|
master_folder = str(instance.lpp_id)
|
||
|
address = "lpp_documents/" + str(master_folder)
|
||
|
final_path = basePath + "/media/" + address
|
||
|
if not Path(final_path).exists():
|
||
|
os.mkdir(final_path)
|
||
|
address = "lpp_documents/" + str(master_folder) + "/"
|
||
|
return os.path.join(address, filename)
|
||
|
|
||
|
|
||
|
class MNFLPPDDatabase(models.Model):
|
||
|
lpp_id = models.UUIDField(
|
||
|
primary_key=True, default=uuid.uuid4, editable=False)
|
||
|
user_id = models.ForeignKey(
|
||
|
User, on_delete=models.CASCADE, default="", blank=True, null=True
|
||
|
)
|
||
|
date_at = models.DateField(auto_now_add=True)
|
||
|
approved_on = models.DateField(null=True, blank=True)
|
||
|
first_name = models.CharField(max_length=100, null=True, blank=True)
|
||
|
last_name = models.CharField(max_length=100, null=True, blank=True)
|
||
|
lpp_email = models.CharField(max_length=100, null=True, blank=True)
|
||
|
country = models.CharField(max_length=100, null=True, blank=True)
|
||
|
province = models.CharField(max_length=100, null=True, blank=True)
|
||
|
city = models.CharField(max_length=100, null=True, blank=True)
|
||
|
contact = models.CharField(max_length=100, null=True, blank=True)
|
||
|
countryCode = models.CharField(max_length=100, null=True, blank=True)
|
||
|
motherTongue = models.CharField(max_length=100, null=True, blank=True)
|
||
|
fathersMotherTongue = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
mothersMotherTongue = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
firstLanguage = models.CharField(
|
||
|
max_length=225,
|
||
|
null=True,
|
||
|
)
|
||
|
choice11 = models.BooleanField(default=False)
|
||
|
choice12 = models.BooleanField(default=False)
|
||
|
choice13 = models.BooleanField(default=False)
|
||
|
choice14 = models.BooleanField(default=False)
|
||
|
firstLangMedium = models.CharField(max_length=100, null=True, blank=True)
|
||
|
firstlangDialect = models.CharField(max_length=200, null=True, blank=True)
|
||
|
firstlangaccent = models.CharField(max_length=200, null=True, blank=True)
|
||
|
secondLanguage = models.CharField(max_length=225, null=True)
|
||
|
choice21 = models.BooleanField(default=False)
|
||
|
choice22 = models.BooleanField(default=False)
|
||
|
choice23 = models.BooleanField(default=False)
|
||
|
choice24 = models.BooleanField(default=False)
|
||
|
secondLangMedium = models.CharField(max_length=200, null=True, blank=True)
|
||
|
secondlangDialect = models.CharField(max_length=200, null=True, blank=True)
|
||
|
secondlangaccent = models.CharField(max_length=200, null=True, blank=True)
|
||
|
scripts = models.CharField(max_length=100, null=True, blank=True)
|
||
|
|
||
|
firstLangDegree = models.CharField(max_length=100, null=True, blank=True)
|
||
|
firstLangAwardedBy = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
firstLangDegreeFile = models.FileField(
|
||
|
upload_to=get_file_path,
|
||
|
null=True,
|
||
|
)
|
||
|
secondLangDegree = models.CharField(max_length=100, null=True, blank=True)
|
||
|
secondLangAwardedBy = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
secondLangDegreeFile = models.FileField(
|
||
|
upload_to=get_file_path,
|
||
|
null=True,
|
||
|
)
|
||
|
|
||
|
certificationL1L2 = models.CharField(max_length=100, null=True, blank=True)
|
||
|
certttificationAwardedByL1L2 = models.CharField(
|
||
|
max_length=100, null=True, blank=True
|
||
|
)
|
||
|
durationCertificationL1L2 = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
modeCertificationL1L2 = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
certificationFile = models.FileField(
|
||
|
upload_to=get_file_path,
|
||
|
null=True,
|
||
|
)
|
||
|
|
||
|
# certificationL1L2B = models.CharField(max_length=100, null=True, blank=True)
|
||
|
# certttificationAwardedByL1L2B = models.CharField(max_length=100, null=True, blank=True)
|
||
|
# durationCertificationL1L2B = models.CharField(max_length=100, null=True, blank=True)
|
||
|
# modeCertificationL1L2B = models.CharField(max_length=100, null=True, blank=True)
|
||
|
# certificationFileB = models.FileField(upload_to="folder/",null=True,)
|
||
|
|
||
|
expFirstLang = models.CharField(max_length=100, null=True, blank=True)
|
||
|
expSecondLang = models.CharField(max_length=100, null=True, blank=True)
|
||
|
scriptWrittenFirstLang = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
scriptWrittenFirstLangLink = models.CharField(
|
||
|
max_length=1000, null=True, blank=True
|
||
|
)
|
||
|
scriptWrittenSecondLang = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
scriptWrittenSecondLangLink = models.CharField(
|
||
|
max_length=1000, null=True, blank=True
|
||
|
)
|
||
|
noScriptTransFromL1toL2 = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
noScriptTransFromL1toL2Link = models.CharField(
|
||
|
max_length=1000, null=True, blank=True
|
||
|
)
|
||
|
noScriptTransFromL2toL1 = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
noScriptTransFromL2toL1Link = models.CharField(
|
||
|
max_length=1000, null=True, blank=True
|
||
|
)
|
||
|
noArticleTransFromL1toL2 = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
noArticleTransFromL1toL2Link = models.CharField(
|
||
|
max_length=1000, null=True, blank=True
|
||
|
)
|
||
|
noArticleTransFromL2toL1 = models.CharField(
|
||
|
max_length=100, null=True, blank=True)
|
||
|
noArticleTransFromL2toL1Link = models.CharField(
|
||
|
max_length=1000, null=True, blank=True
|
||
|
)
|
||
|
|
||
|
status = models.CharField(max_length=1000, null=True, blank=True)
|
||
|
foreigndetails = models.CharField(max_length=2000, null=True, blank=True)
|
||
|
bankname = models.CharField(max_length=1000, null=True, blank=True)
|
||
|
accountno = models.CharField(max_length=1000, null=True, blank=True)
|
||
|
ifsccode = models.CharField(max_length=1000, null=True, blank=True)
|
||
|
nameofaccount = models.CharField(max_length=1000, null=True, blank=True)
|
||
|
availabity = models.BooleanField(default=True)
|
||
|
nda = models.FileField(
|
||
|
upload_to=get_file_path,
|
||
|
null=True,
|
||
|
)
|
||
|
score = models.IntegerField(
|
||
|
default=0,
|
||
|
null=True,
|
||
|
)
|
||
|
level = models.CharField(max_length=100, null=True,
|
||
|
default="Beginner", blank=True)
|
||
|
rank = models.IntegerField(default=0, null=True)
|
||
|
rating = models.IntegerField(default=0, null=True)
|
||
|
date_selection = models.DateField(null=True)
|
||
|
date_last_task_assigned = models.DateField(null=True)
|
||
|
date_last_task_completion = models.DateField(null=True)
|
||
|
no_task_completed = models.IntegerField(default=0, null=True)
|
||
|
no_task_rejected = models.IntegerField(default=0, null=True)
|
||
|
lpp_task_balance = models.DecimalField(
|
||
|
default=0.0, max_digits=10, decimal_places=2)
|
||
|
lpp_withdraw_request = models.BooleanField(default=False)
|
||
|
lpp_withdraw_amount = models.DecimalField(
|
||
|
default=0.0, max_digits=10, decimal_places=2)
|
||
|
|
||
|
class LPPTASKDatabase(models.Model):
|
||
|
|
||
|
task_id = models.UUIDField(
|
||
|
primary_key=True, default=uuid.uuid4, editable=False)
|
||
|
user_id = models.ForeignKey(User, on_delete=models.CASCADE)
|
||
|
date_at = models.DateTimeField(
|
||
|
auto_now_add=True,
|
||
|
null=True,
|
||
|
)
|
||
|
date_task_assigned = models.DateTimeField(
|
||
|
null=True,
|
||
|
blank=True
|
||
|
)
|
||
|
usernote = models.CharField(max_length=500, null=True, default="")
|
||
|
generated_from = models.CharField(
|
||
|
max_length=300, choices=gen_from, null=True, blank=True
|
||
|
) # conversion, sub-1, sub-2, onepager
|
||
|
possiblelpp_action = models.ManyToManyField(
|
||
|
MNFLPPDDatabase, related_name="possiblelpps_action", default="", blank=True
|
||
|
)
|
||
|
assignedlpp_action = models.ForeignKey(
|
||
|
MNFLPPDDatabase,
|
||
|
on_delete=models.SET_DEFAULT,
|
||
|
related_name="assignedlpp_action",
|
||
|
default="",
|
||
|
blank=True,
|
||
|
null=True,
|
||
|
)
|
||
|
eligiblelpp_action = models.ManyToManyField(
|
||
|
MNFLPPDDatabase, related_name="eligiblelpp_action", null=True, default=""
|
||
|
)
|
||
|
lppacceptancetime_action = models.DateTimeField(null=True)
|
||
|
deadlinetolpp_action = models.DateTimeField(null=True)
|
||
|
completiontime_action = models.DateTimeField(null=True)
|
||
|
ratingonmachinetranslation_action = models.IntegerField(
|
||
|
default=0, null=True)
|
||
|
mistakeperpage_action = models.CharField(
|
||
|
max_length=50, null=True, default="")
|
||
|
paymentstatus_action = models.BooleanField(default=False)
|
||
|
amoutgiventolpp_action = models.CharField(
|
||
|
max_length=50, null=True, default="")
|
||
|
amoutgiventolpp_curr_action = models.CharField(
|
||
|
max_length=100, null=True, default="")
|
||
|
|
||
|
possiblelpp_dialogue = models.ManyToManyField(
|
||
|
MNFLPPDDatabase, related_name="possiblelpps_dialogue", default="", blank=True
|
||
|
)
|
||
|
assignedlpp_dialogue = models.ForeignKey(
|
||
|
MNFLPPDDatabase,
|
||
|
on_delete=models.SET_DEFAULT,
|
||
|
related_name="assignedlpp_dialogue",
|
||
|
default="",
|
||
|
blank=True,
|
||
|
null=True,
|
||
|
)
|
||
|
eligiblelpp_dialogue = models.ManyToManyField(
|
||
|
MNFLPPDDatabase, related_name="eligiblelpp_dialogue", null=True, default=""
|
||
|
)
|
||
|
lppacceptancetime_dialogue = models.DateTimeField(null=True)
|
||
|
deadlinetolpp_dialogue = models.DateTimeField(null=True)
|
||
|
completiontime_dialogue = models.DateTimeField(null=True)
|
||
|
ratingonmachinetranslation_dialogue = models.IntegerField(
|
||
|
default=0, null=True)
|
||
|
mistakeperpage_dialogue = models.CharField(
|
||
|
max_length=50, null=True, default="")
|
||
|
paymentstatus_dialogue = models.BooleanField(default=False)
|
||
|
amoutgiventolpp_dialogue = models.CharField(
|
||
|
max_length=50, null=True, default="")
|
||
|
amoutgiventolpp_curr_dialogue = models.CharField(
|
||
|
max_length=100, null=True, default="")
|
||
|
|
||
|
totalmodifications = models.IntegerField(default=0, null=True)
|
||
|
lpp_action_comment = models.CharField(
|
||
|
max_length=1000, null=True, default="")
|
||
|
lpp_dialogue_comment = models.CharField(
|
||
|
max_length=1000, null=True, default="")
|
||
|
totalamout = models.IntegerField(default=0, null=True)
|
||
|
totalamout_curr = models.CharField(max_length=100, null=True, default="")
|
||
|
status = models.CharField(
|
||
|
max_length=300, choices=stat, null=True, blank=True, default=""
|
||
|
)
|
||
|
translated_script = models.ForeignKey(
|
||
|
ScriptTranslations, on_delete=models.CASCADE, default="", unique=True,blank=True, null=True
|
||
|
)
|
||
|
# translated_ppt = models.ForeignKey(
|
||
|
# pptconversion, on_delete=models.CASCADE, default="",unique=True, blank=True, null=True
|
||
|
# )
|
||
|
# translated_subtitle = models.ForeignKey(
|
||
|
# Videoes, on_delete=models.CASCADE, default="", blank=True, null=True
|
||
|
# )
|
||
|
# translated_onepager = models.ForeignKey(OnePager_translations)
|
||
|
|
||
|
outputfile = models.FileField(
|
||
|
upload_to="lpptaskfolder/", null=True, max_length=200)
|
||
|
sub_video_id = models.CharField(max_length=50, null=True, default="")
|
||
|
video_file_path = models.FileField(
|
||
|
upload_to="lpptaskfolder/", null=True, max_length=200
|
||
|
)
|
||
|
lpp_invoice_action = models.CharField(
|
||
|
max_length=300, null=True, default="")
|
||
|
lpp_invoice_dialogue = models.CharField(
|
||
|
max_length=300, null=True, default="")
|
||
|
sub_src_srt_id = models.CharField(max_length=50, null=True, default="")
|
||
|
sub_tar_srt_id = models.CharField(max_length=50, null=True, default="")
|
||
|
|
||
|
class Meta:
|
||
|
ordering = ['date_at']
|
||
|
|
||
|
def __str__(self):
|
||
|
return str(self.date_at)
|