Is it possible to set the default sort order for a model to a field from a related model (rather than the integer key) i.e. something that yields a SQL order by clause with
class Question(models.Model):
question_text=models.CharField(max_length=200)
class Meta:
verbose_name_plural=" Question"
class Choice(models.Model):
question=models.ForeignKey(Question,on_delete=models.CASCADE)
class Meta:
verbose_name_plural=" Choice"
Either you can alter the number of spaces before the class name as above or order it using numbers as below:
class Question(models.Model):
question_text=models.CharField(max_length=200)
class Meta:
verbose_name_plural="1.Question"
class Choice(models.Model):
question=models.ForeignKey(Question,on_delete=models.CASCADE)
class Meta:
verbose_name_plural="2.Choice"