Задать вопрос

Тел: +7 965 3737 888

457

Просмотров

1

Ответов

more on manager methods

<p><a href="http://foothold.ru/knowledge/detail/using-manager-methods.html">Snippet #2</a> demonstrated some cool tricks possible with manager methods. This example shows how to assign and use a custom manager method.</p>
<p>In this snippet the belongs_to_user method returns an Account queryset containing only those accounts associated with the specified user. The method is useful because it hides the implementation of User in the Account model.</p>
<p>Line 17 associates the custom manager with the Account model.</p>

Вопрос полезен? Да0/Нет0
file_4984.py(708.0б)
None

Ответы (1):

Ответadurdin:01.03.2007
Ответ полезен? Да0/Нет0

The first line of belongs_to_user() would be better as:

qs = self.get_query_set()