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

136
Visualizações
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 à 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