Here is my filter:
@register.filter
def filter_by_user(queryset, user):
"""Filter the queryset by (currently logged in) user"""
return queryset.filter(accountowner=user)
Here is my template:
<td>{{ object_list.all|filter_by_user:user|safeseq|join:". " }}</td>
Here is the output:
ACB test 5.0 55.0. ACB test 14.0 144.0
Here is what I d rather have
1. ACB test 5.0 55.0 Edit Delete
2. ACB test 14.0 144.0 Edit Delete
Use
unordered_listrather thanjoin– despite the name, if you wrap it in<ol>...</ol>tags, it’ll be an ordered list.However, you should really be doing this in the view.
Edit
Actually, here’s a better solution:
Of course, this relies on you having
edit_objectanddelete_objecturls in your urlconf.