java中的接口是类吗
258
2022-09-03
Django 学习笔记(六)
Django1.5 关于from django.contrib.syndication.views import Feed 的变更
1.5中只有views.py一个文件,其他的在1.5都删除了
A simple example
This simple example, taken from a hypothetical police beat news site describes a feed of the latest five news items:
from django.contrib.syndication.views import Feedfrom django.core.urlresolvers import reversefrom policebeat.models import NewsItemclass LatestEntriesFeed(Feed): title = "Police beat site news" link = "/sitenews/" description = "Updates on changes and additions to police beat central." def items(self): return NewsItem.objects.order_by('-pub_date')[:5] def item_title(self, item): return item.title def item_description(self, item): return item.description # item_link is only needed if NewsItem has no get_absolute_url method. def item_link(self, item): return reverse('news-item', args=[item.pk])
1.4以前
from django.contrib.syndication.views import feed
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~