Source

django-pim / pcbank / feeds.py

Full commit
Kevin Veroneau fffb63b 





















from django.contrib.syndication.views import Feed
from pcbank.models import Bank, CreditCard

class BankingBookmarks(Feed):
    title = 'Online banking'
    link = "/pcbank/"
    description = "Online banking links RSS Feed"
    def items(self):
        bank_list = Bank.objects.filter(active=True)
        cc_list = CreditCard.objects.filter(active=True)
        names = []
        for bank in bank_list:
            names.append(bank.title)
        for cc in cc_list:
            names.append(cc.title)
        return names
    
    def item_link(self, item):
        try:
            obj = Bank.objects.get(title=item)
        except Bank.DoesNotExist:
            obj = CreditCard.objects.get(title=item)
        return obj.url