class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
telefon = encrypt(models.CharField(max_length=70,default="",null=True))
and a class with documents incl. fotos:
class Document(models.Model):
profile_link = models.ForeignKey(Profile, blank=True,null=True, on_delete=models.SET_NULL,related_name="document_profile_link")
Now in html template i want that all fotos per profile is show:
{% for Profile in Profiles %}
{% for Document in Documents %}
{% if '.png' in document.file or '.jpg' in document.file %}
<td> <img src="{{document.file}}" alt="" height="42" > </td>
{% else %}
<td>No Image</td>
{% endif %}
{% endfor %}
{% endfor %}
Where can i link for Documents loop to Profile?
Regards