title: How to get the foreignKey related primary key (pk) in the same model in django?
body: <p>I need to get the id (pk) of a related model.foreignKey object in order to set the "upload_to" attr of a model.FileField of the same model. </p>
  
  <p>Something like this:</p>
  
  <pre><code>class myClass(models.Model):
      related_model = models.ForeignKey(RelatedModel,on_delete=models.CASCADE)
      file = models.FileField(upload_to=str(related_model.id)+"/")
  </code></pre>
  
  <p>So for example, if the related_model has the primary_key 10 the upload_to attr has to be "10/"</p>
  
  <p>It is possible or I have to set that value in the view.py file when the object is created?</p>