> FWIW, by that time, the MyModel class doesn't even exists yet - you > can't refer to the current class object inside a 'class' statement > body.
Yes, you are right. What I meant was: class MyModel(models.Model): ... MyModel.CONST = MyModel.objects.get(id=1) > You could write a custom descriptor then. But the whole idea of a > class-level pseudo-constant pointing to a model instance still looks > rather backward to me. What is a custom descriptor? I have never used it. Is it something like a property? > Oh, and while were at it: the Python standard for the current class > param name in a classmethod is 'cls', not 'Class' ;) I have seen both cls and klass in django code. I prefer mine, because it clearly indicates, that the objects is not an instance, but a class (and therefore type instance, right?). > Yes they do - as long as their metaclass derives from the appropriate > metaclass (ModelBase IIRC but better to check it out). I'll definitely try that. -- Filip Gruszczyński -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.