Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

341
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda