Open Haridevhub opened 2 years ago
Unable to apply sorting functionality to embedded fields.
Consider the following model structures:
class User(models.Model): user_name=models.CharField(max_length=120,help_text='User Name') user_id=models.CharField(max_length=120,help_text='User Id') objects=models.DjongoManager() class Meta: abstract = True def str(self): return self.user_id
class TTS(models.Model): _id = models.ObjectIdField() input_sentence = models.TextField() name = models.CharField(max_length=500, blank=True) user = models.EmbeddedField(model_container=User) objects = models.DjongoManager() def str(self): return str(self._id)
I am trying to sort the results of filter on model TTS based on the user__user_name field, for which i'm getting an error.
filter function: TextToSpeech.objects.order_by("user__user_name").values()
This is doable using mongodb query.
Can anyone suggest a solution for this?
Unable to apply sorting functionality to embedded fields.
Consider the following model structures:
class User(models.Model): user_name=models.CharField(max_length=120,help_text='User Name') user_id=models.CharField(max_length=120,help_text='User Id') objects=models.DjongoManager() class Meta: abstract = True def str(self): return self.user_id
class TTS(models.Model): _id = models.ObjectIdField() input_sentence = models.TextField() name = models.CharField(max_length=500, blank=True) user = models.EmbeddedField(model_container=User) objects = models.DjongoManager() def str(self): return str(self._id)
I am trying to sort the results of filter on model TTS based on the user__user_name field, for which i'm getting an error.
filter function: TextToSpeech.objects.order_by("user__user_name").values()
This is doable using mongodb query.
Can anyone suggest a solution for this?