Hi,
I've done something similar to this using annotation. It is a bad
nasty, but should work.
Firstly annotate all the MyModel instances with the max value of the
pk of the MyOtherModel:
qs = MyModel.objects.annotate(last_pk=Max('myothermodel__pk'))
Then filter these based on the myString:
qs
I have these two rather simple models that looks something like this:
class MyModel(models.Model):
myName=models.CharField(max_length=60)
class MyOtherModel(models.Model):
myString=models.CharField(max_length=60)
myModel=models.ForeignKey(MyModel)
I will eventually have quite
2 matches
Mail list logo