Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

340
Vistas
How to count how many times is finished function in django?

I have created a function in Django with the purpose that users download files after they fill some form. I want to count how many times is downloaded a file, now how many times is called function. And I want to show that number on my site. How do I do this?

This is my function...

def Only(request):
    page_title = 'Title'
    if request.method == "POST":
        form = Form(request.POST, request.FILES)
        if form.is_valid():

            newdoc = request.FILES['file']
            #some tasks

            response = HttpResponse(
                output, content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
            response['Content-Disposition'] = 'attachment; filename=%s' % filename
            return response
    else:
        form = Form()
    return render(request, 'only.html', { 'form': form, 'page_title':page_title })
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You should create a new integer field in the table where the information of this form is saved. Then when someone fills the form and downloads the file you should update it with +1.

To show this field, first you should create a new post (or get) method to get the field value, and then, you should call this method when you load the page.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda