I find myself being inconsistent in whether I put model helper methods
on a custom manager or just as top-level functions in models.py
For example, in django-friends I have:
class FriendshipManager(models.Manager):
def friends_for_user(self, user):
...code with self.filter...
whereas I just accepted a patch to django-notification that has:
def notices_for(user, archived=False):
...code with Notice.objects.filter...
Any thoughts on best practices? Heuristics for deciding which to use?
I'd like some consistency across all my reusable apps.
James
--
James Tauber http://jtauber.com/
journeyman of some http://jtauber.com/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---