Answer the question
In order to leave comments, you need to log in
How to get a filtered list of objects in a function under a model?
I have a client model:
class Client(models.Model):
investmen = models.ForeignKey(InvestmentAdvisor, on_delete=models.CASCADE, related_name='client')
name = models.CharField(max_length=255)
description = models.TextField(blank=True)
date_of_birth = models.DateField()
retirement_date = models.DateField()
drawdown_behavior = models.PositiveSmallIntegerField(choices=DRAWDOWN_BEHAVIOR,)
employment_status = models.PositiveSmallIntegerField(choices=EMPLOYMENT_STATUS,)
def get_filter_portfolio(self):
return self.portfolio.objects.filter(name='123213')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question