Answer the question
In order to leave comments, you need to log in
Need help with Django ORM (formulate query)?
Good afternoon!
There are some models:
class Binds(models.Model):
...
name = models.CharField()
...
class Repayment(models.Model):
...
bond = models.ForeignKey('Bonds')
date_repay = models.DateField()
type_repay = models.CharField(choise=REPAY_T)
...
Answer the question
In order to leave comments, you need to log in
So what?
bond = Repayment.objects.filter(date_repay__gt=datetime.now()).order_by("date_repay")[0].bond
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question