我有模型:
class Model_1(models.Model):
name = ...
[...]
class Model_2(models.Model):
model_1 = models.ForeignKey(Model_1)
现在我在视图中获得了model_1对象,在模板中我想获得model_2:
{% for m in models_1 %}
{{ m.model_2 }} ?????
{% endfor %}
怎么做?
我有模型:
class Model_1(models.Model):
name = ...
[...]
class Model_2(models.Model):
model_1 = models.ForeignKey(Model_1)
现在我在视图中获得了model_1对象,在模板中我想获得model_2:
{% for m in models_1 %}
{{ m.model_2 }} ?????
{% endfor %}
怎么做?