#post_detail.html
<code lang="html">
{%extends 'home.html'%}
{%block content%}
<p> Back to <a href="{% url 'home' %}"> All Posts </a></p>
<div class="post-entry">
<h2> {{object.title}} </h2>
{% if object.image %}
<h2> <img src="{{object.image}}"></h2>
{% else %}
< p> нет изображения </p>
{% endif %}
<h2> <img src="{{object.cover.url}}"></h2>
</div>
{%endblock content%}
</code>
room = models.ForeignKey(Room, on_delete=models.CASCADE)
<имя виртуального окружения>\Scripts\activate
def UniversalForeignKey(to, **kwargs):
return models.ForeignKey(
to=to,
null=True,
verbose_name='test',
on_delete=models.CASCADE,
**kwargs
)
class Test1(models.Model):
test = UniversalForeignKey('app_model')