I am trying to order QuerySet by a method defined in my class
Class EgzampleClass(models.Model):
somefield = models.ForeignKey(User)
otherfield = models.CharField()
@property
def mymethod(self):
countsth=1
return countsth
I would like to do a thing like this
EgzampleClass.objects.all().order_by('mymethod')
Does anyone have an idea how can I do it? Thanks in advance