My dabbling has led me to believe this is more of a Python related issue, but googling outside of DRF isn't yielding much in the way of answers, and it might be a DRF thing after all. So I'll take a different approach. Let me know if I have any misconceptions.
The individual serializer fields are created as class attributes? Class attributes can't be defined using "self", or instanced variables? Class attributes can't be changes once defined? Serializer functions only get called once? *I believe I've isolated my problem that I need to pass self/instance variables into a class attribute.* *I am trying to restrict the choices in a dropdown menu or list in the API creation/update area, for one-to-many or many-to-many relationships, respectively.* I currently have 2 game objects. 44 Player and Max Player. So the unfiltered field in the API we get: serializers.py class DependentYearSerializer(serializers.ModelSerializer): game_name = serializers.PrimaryKeyRelatedField(queryset=Game.objects.all ()) would look like: [image: Queryset All.jpg] *I can set another class variable, which gets passed into the serializer field and properly restricts choices in the API:* serializers.py class DependentYearSerializer(serializers.ModelSerializer): game_filter = '44P' game_name = serializers.PrimaryKeyRelatedField(queryset=Game.objects. filter(designation=game_filter)) [image: Queryset Filtered.jpg] But I am having a lot of difficulty dynamically updating the variable: serializers.py class DependentYearSerializer(serializers.ModelSerializer): game_filter = '44P' def update_game_filter(self): game_filter = 'MaxMap' game_name = serializers.PrimaryKeyRelatedField(queryset=Game.objects. filter(designation=game_filter)) Still produces the same result. game_filter is still being passed in as '44P' and not updating. [image: Queryset Filtered.jpg] Ultimately, I'd like game_filter to be defined from a variable, self.context.get('game') which was passed in from the view, and not just another arbitrary string in my test method. -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.