[Answer]-GenericForeinKey retrieve field value in models.py

1👍

That is because you are not returning anything from modeltestname. If a function or method does not return anything explictly, it would return None by default. Hence the result

So change the class method to

def modeltestname(self):
    return self.content_object.name

Leave a comment