title: Django - How to GET value from table where I don't have foreign key in table from which I want to GET object?
body: <p>Let's assume that I have for instance table <code>Object1</code> with columns <code>id</code>,<code>id_users</code> where <code>id_users</code> is a foreign key of <code>id</code> from <code>auth_user</code> table and table <code>Object2</code> with columns <code>id</code>,<code>id_object1</code>,<code>sth</code>, where <code>id_object1</code> is a foreign key of <code>id</code> from <code>Object1</code> table.<code>ID</code> of Object1 and Object2 is automatically incremented in mySQL database.</p>
  
  <p>I would like to have for instance such URL <code>/users/{id}/object2/?sth=123</code> and I would like to get object from <code>Object2</code> table where <code>{id}</code> is <code>id</code> of the user from <code>auth_user</code> table (in this case is equals <code>2</code>) and <code>sth</code> is equals <code>123</code> in <code>Object2</code> table in appropriate field.</p>
  
  <p>Let's assume this is my model:</p>
  
  <pre><code>class Object1(models.Model):
  
      id_users = models.PositiveIntegerField(blank=True)
  
  class Object2(models.Model):
  
      id_object1 = models.FloatField()
      sth = models.FloatField()
  </code></pre>
  
  <p>I had quite similar problem which was solved in this post - <a href="https://stackoverflow.com/questions/44221103/django-how-can-i-create-post-with-foreign-key-defined-in-url">Django - How can I create POST with foreign key defined in URL?</a> but in this case I don't have <code>foreign key</code> in table from which I want to GET object. I have no idea what is the best way to solve this problem. Thanks in advance.</p>