title: How can i get data from a specific user rather then ID in my django app
body: <p>i am trying to get date from a user when sending a webhook. The JSON will be handling the username of which user i want the data to be used from . but i get an error that user is expecting an id how can i make it that it is looking for a username rather then id.<a href="https://i.stack.imgur.com/BIFnc.png" rel="nofollow noreferrer">This is the error</a></p>
  <p>and this is my Models code</p>
  <pre><code>    class Bybitapidatas(models.Model):
          #user = models.OneToOneField(User, null=True,on_delete=models.CASCADE)
          user = models.ForeignKey(settings.AUTH_USER_MODEL,default=1,on_delete=models.CASCADE)
          apikey = models.CharField(max_length=30)
          apisecret = models.CharField(max_length=40)
      
          
          def __str__(self):
              return str(self.user) + self.apikey + self.apisecret
  </code></pre>
  <p>and this is my views file where i am trying to get the data for the user</p>
  <pre><code>@csrf_exempt
  @require_POST
  def webhook(request):
      #get current users keys        
      jsondata = request.body
      data = json.loads(jsondata)
      for the_data in data: 
        users = the_data
        print(users)
      
  
      database = Bybitapidatas.objects.get(user=users)# this is where it is asking for the id?
      for apikey in database:
          apikey = apikey.apikey
      for apisecret in database:
          apisecret = apisecret.apisecret
  
      session = HTTP(endpoint='https://api-testnet.bybit.com/', api_key=apikey, api_secret=apisecret,spot=True)
      print(session.place_active_order(
          symbol=&quot;BTCUSDT&quot;,
          side=&quot;Buy&quot;,
          type=&quot;MARKET&quot;,
          qty=&quot;20&quot;,
          timeInForce=&quot;GTC&quot;
      ))
      print(apikey)
  
  </code></pre>