The queryset parameter you’re receiving is the queryset defining the individual objects to be acted upon. If you want to do something with each of the selected objects, you need to iterate over that queryset.
Your query on MyModel references a variable named “code” that doesn’t seem to be defined within this method.
r = MyModel.objects.get(code__exact=code).param_secret
I’m guessing you want to retrieve this value for each member of the queryset.
What does your urls.py entry for generatePdfAuth look like? (Does it have a parameter for a code to be passed to it?) This also doesn’t look like it’s going to work if multiple rows are selected - the first return is going to prevent any of the other selected objects from being processed.
You might want to take a step back and reread the Admin actions docs, particularly the sections on Actions that provide intermediate pages.
If you’re going to allow multiple selections to be processed, you might also want to change how you’re forwarding data from this action to your view that is going to process those selections.