How to get values of a dictionary in a Django Template without for loop

I am trying to get a value of a dictionary in a Django Template. I am not sure whether this is possible or not.

Here is the following template:

{{ active_session.log.values }}

This is the print out of it:

<QuerySet [{'id': 318, 'log_order': 1, ......other repeated keys and values}>

My question how can get all the values of the log_order with going through a for loop in the template knowing that it is a many to many relationship.

Here is the models:

class Log(models.Model):
    ...................................
    log_order = models.IntegerField(validators=[MinValueValidator(1)],blank=True, null=True)

class ActiveSession(models.Model):
    log = models.ManyToManyField(Log, related_name='savedlogs')
    ..................................

here is the views:

class workout_details(DetailView):
    model = Workout
    template_name = 'my_gym/start_workout.html'
    context_object_name = 'workout'

    def get_context_data(self, **kwargs):
        exercises = Exercise.objects.filter(workout_id=self.object)
        p = Log.objects
        active_session = ActiveSession.objects.get(id=ActiveSession.objects.last().id)
        context = super().get_context_data(**kwargs)
        context['exercises'] = exercises
        context['form'] = LogForm()
        context['p'] = p
        context['active_session'] = active_session
        return context

There are several answers out there saying that can create a function lookup but it got me an error Failed lookup for key [log_order] in <django.db.models.fields.related_descriptors.create_forward_many_to_many_manager.<locals>.ManyRelatedManager object at 0x046FE4A8>

Here is the function in the models:

@register.filter(name='lookup')
def lookup(value, arg):
    value_dict = ast.literal_eval(value)
    return value_dict.get(arg)

Here is the template:

{{ mydict|lookup:active_session.log.log_order }}
Back to Top