title: How to handle parallel request in Django Rest Framework?
body: <p>I have created an API in <strong>DRF</strong> which accepts POST request with some data, But sometimes I feel that same requests are coming in parallel which causing the duplicate data in DB. </p>
  
  <pre><code>class Feedback(models.Model):
      user = models.ForeignKey(Student)
      message = models.CharField(max_length=255)
  </code></pre>
  
  <p>Use can send same feedback multiple time. Let's think it's an open API so anyone can consume it and in someone's app user clicks multiple time on button and I received multiple requests but data should be saved only one time.</p>
  
  <p>I have tried by adding a <code>BooleanField</code> to <code>Student</code> table and used the following code to prevent it. But as multiple requests coming in parallel they can read the same value <code>True</code>.</p>
  
  <pre><code>if student.can_submit_feedback:
     student.can_submit_feedback = False
     student.save()
  else:   
     # Code for saving feedback
     student.can_submit_feedback = True
     student.save() 
  </code></pre>
  
  <p>I want to process only one API call on same endpoint and same IP at a time. How can I achieve it?</p>
  
  <p>Updated</p>
  
  <p>I have researched and found that we can add lock on table or object but I am looking for prevention on requests level</p>