Hi all !
I am currently implementing a django app, for this I try to use a syntax that is consistent with Django's...
So here is what I am trying :
class Blablabla(Model):
#this contains Blablabla's options
class Meta:
sort_key = lambda e: e
sort_key
is a key function (for sorting purposes), but of course, it is understood as Meta
's method (which is absolutely not what I want)!!!
Any workaround to this, that would still allow me to use this syntax ?
EDIT :
Just an important precision ... the code I wrote is supposed to be written by somebody that uses the library ! That's why I don't want any dirty trick. And YES in Django it is really used just for options... of course Meta IS a class, but I say "it is not seen as a class", because it is not used as a class : you don't instantiate it, you don't put class methods, only class attributes... The Model
has a metaclass that extracts everything from this Meta
and handles all the options declared... But that's all ! It IS just a placeholder for options.
But OK that's True I never saw an option that is a function in Django... So I'll follow Ned an declare this sorting function as a method of Model
that has to be overriden ...