[Answer]-Accessing the models fields DetailView

1👍

profile is a queryset, not an instance. Querysets don’t have a slug attribute.

You either need to get a specific instance of Profile in your extra method, or iterate through the profiles in your template.

0👍

The fact that [<Profile: Red>] is visible in the test output indicates that you are passing Profile instance to the template correctly.

Therefore the problem lies within profile.slug. Are you sure that you have slug field on your Profile class?

👤pajton

Leave a comment