On 11/17/06, Kamil Wdowicz <[EMAIL PROTECTED]> wrote: > > It is possible to access, and do a query inside models.py ? > > Something like this: > > class Tag(models.Model): > #props... > > def _get_count(self): > return Tag.objects.all().count() > > counter = property(_get_count) > > Do you know what I mean ? > According to the docs [1] Model Methods (like your proposed _get_count() method) are for "row level" functionality. That means the method would apply to a specific row in your db at a time. However, in your example you want to access "table wide" data. That would be were Model Managers come in.
[1]: http://www.djangoproject.com/documentation/model_api/#id6 [2]: http://www.djangoproject.com/documentation/model_api/#managers -- ---- Waylan Limberg [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---