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

131
Views
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
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!