Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

334
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!