Example #1
0
def rechazar_video(request, tk_str):
    v = token.is_valid_token(tk_str)
    if not v:
        return render_to_response("section-ticket-caducado.html")

    if request.method == "POST":
        form = IncidenciaProduccionForm(request.POST)
        if form.is_valid():
            inpro = form.save(commit=False)
            inpro.informe = v.informeproduccion
            inpro.aceptado = False
            inpro.save()
            token.token_attended(v)
            v.status = "REC"
            v.save()
            return render_to_response(
                "section-resumen-aprobacion.html", {"v": v, "aprobado": False}, context_instance=RequestContext(request)
            )
    else:
        form = IncidenciaProduccionForm()
    return render_to_response(
        "section-rechazar-produccion.html",
        {"v": v, "form": form, "token": tk_str},
        context_instance=RequestContext(request),
    )
Example #2
0
def definir_metadatos_user(request, tk_str):
    v = token.is_valid_token(tk_str)
    if not v:
        return render_to_response("section-ticket-caducado.html")

    if v.objecto_aprendizaje:
        MetadataForm = MetadataOAForm
        metadataField = "metadataoa"
    else:
        MetadataForm = MetadataGenForm
        metadataField = "metadatagen"

    initial_data = {"title": v.titulo, "creator": v.autor}

    if request.method == "POST":

        form = (
            MetadataForm(request.POST, instance=getattr(v, metadataField))
            if hasattr(v, metadataField)
            else MetadataForm(request.POST, initial=initial_data)
        )
        if form.is_valid():
            m = form.save(commit=False)
            m.video = v
            m.date = v.informeproduccion.fecha_grabacion
            m.created = v.informeproduccion.fecha_produccion
            m.save()
            inpro = IncidenciaProduccion(informe=v.informeproduccion, aceptado=True)
            inpro.save()
            token.token_attended(v)
            v.status = "ACE"
            v.save()
            return render_to_response(
                "section-resumen-aprobacion.html", {"v": v, "aprobado": True}, context_instance=RequestContext(request)
            )

    else:
        form = (
            MetadataForm(instance=getattr(v, metadataField))
            if hasattr(v, metadataField)
            else MetadataForm(initial=initial_data)
        )

    return render_to_response(
        "section-metadatos-user.html", {"form": form, "v": v, "token": tk_str}, context_instance=RequestContext(request)
    )
Example #3
0
def rechazar_video(request, tk_str):
    v = token.is_valid_token(tk_str)
    if not v: return render_to_response("postproduccion/section-ticket-caducado.html")

    if request.method == 'POST':
        form = IncidenciaProduccionForm(request.POST)
        if form.is_valid():
            inpro = form.save(commit = False)
            inpro.informe = v.informeproduccion
            inpro.aceptado = False
            inpro.save()
            token.token_attended(v)
            v.status = 'REC'
            v.save()
            return render_to_response("postproduccion/section-resumen-aprobacion.html", { 'v' : v, 'aprobado' : False }, context_instance=RequestContext(request))
    else:
        form = IncidenciaProduccionForm()
    return render_to_response("postproduccion/section-rechazar-produccion.html", { 'v' : v, 'form' : form, 'token' : tk_str }, context_instance=RequestContext(request))
Example #4
0
def definir_metadatos_user(request, tk_str):
    v = token.is_valid_token(tk_str)
    if not v: raise Http404

    if request.method == 'POST':
        form = MetadataForm(request.POST, instance = v.metadata) if  hasattr(v, 'metadata') else MetadataForm(request.POST)
        if form.is_valid():
            m = form.save(commit = False)
            m.video = v
            m.date = v.informeproduccion.fecha_grabacion
            m.created = v.informeproduccion.fecha_produccion
            m.save()
            inpro = IncidenciaProduccion(informe = v.informeproduccion, emisor = 'U', aceptado = True)
            inpro.save()
            token.token_attended(v)
            v.status = 'ACE'
            v.save()
            return render_to_response("postproduccion/section-resumen-aprobacion.html", { 'v' : v, 'aprobado' : True }, context_instance=RequestContext(request))
    else:
        form = MetadataForm(instance = v.metadata) if hasattr(v, 'metadata') else MetadataForm()
    return render_to_response("postproduccion/section-metadatos-user.html", { 'form' : form, 'v' : v, 'token' : tk_str }, context_instance=RequestContext(request))
Example #5
0
def definir_metadatos_user(request, tk_str):
    v = token.is_valid_token(tk_str)
    if not v: return render_to_response("postproduccion/section-ticket-caducado.html")

    if v.objecto_aprendizaje:
        MetadataForm = MetadataOAForm
        metadataField = 'metadataoa'
    else:
        MetadataForm = MetadataGenForm
        metadataField = 'metadatagen'

    initial_data = {
        'title' : v.titulo,
        'creator' : v.autor
    }

    if request.method == 'POST':

        form = MetadataForm(request.POST, instance = getattr(v, metadataField)) if  hasattr(v, metadataField) else MetadataForm(request.POST, initial = initial_data)
        if form.is_valid():
            m = form.save(commit = False)
            m.video = v
            m.date = v.informeproduccion.fecha_grabacion
            m.created = v.informeproduccion.fecha_produccion
            m.save()
            inpro = IncidenciaProduccion(informe = v.informeproduccion, aceptado = True)
            inpro.save()
            token.token_attended(v)
            v.status = 'ACE'
            v.save()
            video.add_metadata(v)
            return render_to_response("postproduccion/section-resumen-aprobacion.html", { 'v' : v, 'aprobado' : True }, context_instance=RequestContext(request))

    else:
        form = MetadataForm(instance = getattr(v, metadataField)) if hasattr(v, metadataField) else MetadataForm(initial = initial_data)

    return render_to_response("postproduccion/section-metadatos-user.html", { 'form' : form, 'v' : v, 'token' : tk_str }, context_instance=RequestContext(request))