The thing is that I believe django as a whole would benefit from this
kind of functionality. The whole point of custom managers is to add
functionality, not just to your app, but to every app that FKs against
your models.

In the case of contrib.auth, this functionality is really handy
spanning across related fields.

Considder the case of a template that currently looks like this:

{% for moderator in forum.moderators.all %}
    {% if moderator.active %}
        {{ moderator|profilelink }}{% if not forloop.last %},{% endif
%}
    {% endif %}
{% endfor %}

This is an example of the template code that I add to djangobb by
overriding it's templates. djangobb currently has no custom User
subclass that it injects into it's moderator relationship, and hence i
have to do a filter in the template, or modify djangobb and give up on
getting auto updates without merging my code in every time.

If the user model had a active() or is_active custom manager method
that had use_for_related_fields set to True, then it enables you to
use a very easy syntax:

{% for moderator in forum.moderators.active %}
    {{ moderator|profilelink }}{% if not forloop.last %},{% endif %}
{% endfor %}

which does efficient datbase side filtering of active/inactive
members.

This is the kind of low-hanging fruit that is EASY to implement, would
be used by plenty of people (really, how many people ever want
deactivated users showing up all over their site) and would provide
instant benifit to template writers, and specifically to people who
don't want to modify external apps to add functionality/address
deficiencies in django.


On Sep 28, 5:48 pm, Tomasz Zielinski
<tomasz.zielin...@pyconsultant.eu> wrote:
> I'm the author of #16611 ticket and after some consideration I also think
> that proxy models are the way to go for such customizations.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to