I want to filter the model information pass down from my consumer.py using Django rest framework channels , I hope I get help here .
class ConsultationConsumer(ListModelMixin, GenericAsyncAPIConsumer):
queryset = Consultation.objects.all()
serializer_class = ConsultationSerializer
permission_classes = (permissions.AllowAny,) # Note the trailing comma
async def connect(self):
await self.model_change.subscribe() # Ensure model_change is defined
await super().connect()
@model_observer(Consultation)
async def model_change(self, message, observer=None, **kwargs):
await self.send_json(message)
@model_change.serializer
def model_serializer(self, instance, action, **kwargs):
return dict(data=ConsultationSerializer(instance=instance).data, action=action.value)..
Instead of getting all objects from the query set I want to filter it