Errors in customer.py and chat/model.py .....
Rahil786-bit opened this issue · 0 comments
Rahil786-bit commented
def clean(self, *args, **kwargs):
print(self.users.count())
if self.users.count() < 2:
raise ValidationError("You can't assign less than two Users")
super(Room, self).clean(*args, **kwargs)
def __str__(self):
users = ""
for usr in self.users.all():
users = users+usr.username+", "
return str(users)
//error :Instance of 'ManyToManyField' has no 'count' member
//Instance of 'ManyToManyField' has no 'all' member
//below custper.py
@database_sync_to_async
def save_chat(self, message):
if 'AnonymousUser' != str(self.scope["user"]):
room = Room.objects.last()
msg = ChatMessage.objects.create(room=room, user=self.scope["user"], message=message)
return True
//error :Class 'Room' has no 'objects' member
//Class 'ChatMessage' has no 'objects' member
//Unused variable 'msg'
Thank you