我有2个模型。
class Unit(models.Model):
title = models.CharField(max_length=60)
def __unicode__(self):
return self.title
class UniDoc(models.Model):
title = models.CharField(max_length=100, blank=True, null=True)
units = models.ManyToManyField(Unit, blank=True)
file = models.FileField(upload_to="uploads/")
author = models.ForeignKey(User, null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return self.file.name
如何在模板中的链接 ti 单元上获取 unidoc 列表?