class Template(models.Model):
name = models.CharField(max_length=135, blank=True)
pattern = models.ForeignKey(Pattern)
create_time = models.DateTimeField()
creator = models.CharField(max_length=135, blank=True)
我想:
Template.objects.extra(where=[str]).order_by('create_time')
并根据foreignkey 'pattern'到 distinct 结果。 这该怎么做? THX〜