Task :
need to create an RSS feed generator. for example: an input of an array of dictionaries comes in - an xml-tape is output =)
What interests :
- What libraries and tools to use for this?
- Ready examples
Django has facilities for data translation (RSS, Atom). For any translation, you must write a class-presentation Feed and specify it in the urls. There may be several broadcasts.
Example:
./views.py
from django.contrib.syndication.views import Feed class TestFeed(Feed): title = "Test" link = "/testfeed/" description = "Test description." def items(self): return [{'title': 'test1', 'desc': 'Test Desc1'}, {'title': 'test2', 'desc': 'Test Desc2'}] def item_title(self, item): return item.title def item_description(self, item): return item.desc We connect url to broadcast.
./urls.py
from django.conf.urls import url from testproject.views import TestFeed urlpatterns = [ # ... url(r'^feed/$', TestFeed()), # ... ] You can also use your own templates for generation.
More details can be found in the documentation:
1. Django Broadcast Media
2. Means of broadcasting Django (for the old version in Russian) ,
Source: https://ru.stackoverflow.com/questions/510430/
All Articles