I have a model,
class Example(models.Model):
MY_CHOICES = (
("yes", _("Yes")),
("no", _("NO")),
("not_sure", _("Not sure")),
)
name = models.CharField(max_length=200, verbose_name=_('Name'))
status = models.CharField(max_length=100,choices=MY_CHOICES,default='yes')
I need to get the query set sorted in the get_queryset method, ie,
def get_queryset(self, request):
qs = self.model._default_manager.get_queryset()
order = ['yes', 'no', 'not_sure']
qs = #CODE TO ORDER THE S HERE BASED ON order.
return qs
*The return value i need is a QuerySet not a sorted list. *The qs need to be sorted based on the the status value according to the order 'yes', 'no', 'not_sure'.
Please Note: I need thr QS based on the object attribute value(ie, status value). In the order objects of status='yes' first followed by 'no' and 'not_sure'