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

132
Vistas
What is the best way dealing with important information that is fetched by client from Django server

I'm building an API that handles users clicking on submit/delete requests to join a sports club. When a request is created/deleted I need the club's PK in order to find the instance of the club (when the ClubRequest instance is created) or the request (when the request for the specific club is deleted).

Model of request

class ClubRequest(models.Model):
 athlete = models.ForeignKey(User, [...])
 timestamp = models.DateTimeField(auto_now_add = True)
 club = models.ForeignKey(Club,[...])

I fetch a list of all instances of the clubs, then create EventListeners that have one of the parameters the PK of the clubs. The client should receive an encrypted PK.

for (club in list) {
        res = list[club];
        name = res["name"]
        id = res["id"]
        
        createDivs(requested, id)
       
        document.querySelector("#search-name").onclick = null
}

Function that handles submitting/deleting requests

if (new_request == "true") {
    fetch("createRequest", {
        method: "POST",
        body: JSON.stringify({
            "id": club_id
        })
    })
    .then(response => response.json())
    .then(result => {

        changeIcons(self, new_or_old)
        self.classList = "button is-info"
        self.setAttribute("new_or_old", false)
   
    })
} else {
    fetch("undoRequest", {
        method: "POST",
        body: JSON.stringify({
            "id": club_id
        })
    })
    .then(response => response.json())
    .then(result => {
        
        changeIcons(self, new_or_old)
        self.classList = "button is-primary"
        self.setAttribute("new_or_old", true)
       
    })
}

Should I use a public/private key system or is there a better way to do this?

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