22 lines
579 B
Python
22 lines
579 B
Python
# Create your views here.
|
|
from models import Srt
|
|
from django.http import HttpResponse
|
|
|
|
def saveSrt(request):
|
|
txt = request.POST['txt']
|
|
lang = request.POST['language']
|
|
padmaId = request.POST['padmaId']
|
|
srt = Srt(txt=txt, language=lang, padmaId=padmaId)
|
|
srt.save()
|
|
return HttpResponse("saved")
|
|
|
|
def loadSrt(request):
|
|
padmaId = request.GET['padmaId']
|
|
lang = request.GET['language']
|
|
srt = Srt.objects.filter(padmaId=padmaId).filter(language=lang)
|
|
if len(srt) > 0:
|
|
ret = srt[0].txt
|
|
else:
|
|
ret = "No Srt for this language found"
|
|
return HttpResponse(ret)
|