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

156
Views
how to add data to database in django

I send the data I get from websocket with javascript to the view.py section of python-django with var xhr = new XMLHttpRequest() ///. my question is; The data comes to view.py. How can I save this incoming data to the database from now on?

views.py;

def gelismis_alim(request):
    data = json.loads(request.body)
    front_end_adet = data.get('adet')

    //I know probably,I should write here something to add it to database but I don't know what it is.
    
    print(data) 
    return HttpResponse('/')enter code here

the data which sended with js to django, stored in front_end_adet variable.this data is static, not change everytime. When I take a data from websocket I store it in a variable then I send it django view for once.

my model.py;

class AL(models.Model):
    quant = models.CharField(null=False)
    price = models.CharField(null=False)

class SAT(models.Model):
    quant = models.CharField(null=False)
    price = models.CharField(null=False)enter code here

What I want is to add the data in the front_end_piece variable to the quant part of the AL table.I would be glad if you help thank you.

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!