[Django]-How to get the ManyToMany Manager object using the field name

5👍

You need to get attribute value dynamically. Use getattr

def method(self, param_name):
    field = getattr(self, param_name)
    all = field.all()

This should help.

Leave a comment