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

157
Vistas
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
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