Hello,
If I understand correctly, this is same idea as #16611.
This feature was rejected by a core developer, which means it won't be
added to Django.
The rationale is explained in
https://code.djangoproject.com/ticket/16611#comment:5
Thanks for the suggestion!
--
Aymeric Augustin.
> 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.
Isn't the problem here that 'forum.moderators' is returning users who
are not active? djangobb should do this filtering in the objects they
supply to their templates (or at least provide an alternative
'active_moderators'), because this kind of business logic decision
should be made by view code, not template code.
If djangobb is wrong here, you should be filing a bug with them. If they
are right, then your app is 'wrong' for overriding the business logic in
a template. If both are 'right', then this is just an example of a case
where a 3rd party app doesn't do exactly what you want. But there are
many examples of that, and we can't build everything into Django to fix
specific limitations of certain apps.
Regards,
Luke
--
"I think you ought to know I'm feeling very depressed." (Marvin the
paranoid android)
Luke Plant || http://lukeplant.me.uk/