I'm trying to get all customers from a specified business, but there is a class method in Customer model to get some information based on the same Business... Let me explain this with code...
class Business(models.Model):
...
customers = models.ManyToManyField(Customer, blank=True, null=True)
class Customer(models.Model):
...
def get_something(self, obj_business)
...
Ok now in my views I get all customers from a specified business like this:
obj_customers = obj_business.customers.all()
Then I try to print this in my template:
{% for obj_customer in obj_customers %}
{{ obj_customer.get_something ....... }}
But yes, there is not a way to pass arguments... I would like to know if there is something that I'm missing...
I wonder if there is another solution instead creating a template tag... because it is a ManyToManyField, if customers field had been just ForeignKey, no need to pass an argument to that method...