I've got two models with onetoone relation user and blog. While listing users I want to have users with blog on top. How to order users so that users with blog is on first of list and secondary order by users id? My Models:
class User(BaseModel):
name = models.CharField(max_length=100)
class Blog(BaseModel):
user = models.OneToOneField(User, related_name='blog', null=True)
title = models.CharField(max_length=100)
My view:
class UserAPIView(ListAPIView):
queryset = User.objects.all()
serializer_class = UserSerializer