how to get the user and touserid of ChatMsg.objects.filter (user=8,touserid=9) in Django rest framework from the front end of html
class ChatMsg (models.Model):
"""
"""
user = models.ForeignKey(User, verbose_name="",on_delete=models.CASCADE)
msg = models.TextField("",max_length=20000,)
touserid = models.CharField(max_length=32, verbose_name="id",)
read = models.BooleanField(verbose_name="", help_text="",default=False)
add_time = models.DateTimeField(verbose_name="", default=datetime.now)
class Meta:
verbose_name = ""
verbose_name_plural = ""
def __str__(self):
return u"%s" % self.user.id
class ReadMsgView (mixins.DestroyModelMixin,ListModelMixin,viewsets.GenericViewSet)
queryset = ChatMsg.objects.filter(user=8,touserid=9)
serializer_class = ReadMsgSerializer -sharp