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

335
Vistas
How to save data from a webpage into Django database without using a form?

I am trying to save data from my webpage into my Django database. The data does not come from a form - I have built a web-based game with a timer and I would like to store the end value of the timer in my database for each game once the user presses the 'finish' button. The data doesn't come from a form as the timer increments automatically every second and stops when the finish button is pressed - how would i go about saving this to my django database?

this is what the django model looks like:

class Games(models.Model):
    username = models.ForeignKey(User, on_delete=models.CASCADE)
    startTime = models.DateTimeField(auto_now_add=True)
    solveTime = models.IntegerField()
    hintsCount = models.IntegerField()
    difficultyChoices = [
        ('E', 'easy'),
        ('M', 'medium'),
        ('H', 'hard')
    ]
    difficulty = models.CharField(max_length=2, choices=difficultyChoices, default='M')

so for example i would like to be able to send a POST request to the server with {timer: 300, hints:2} which can then be saved with the above model

thanks :)

about 4 years ago · Juan Pablo Isaza
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