本文整理汇总了Python中models.Feed.feed_url方法的典型用法代码示例。如果您正苦于以下问题:Python Feed.feed_url方法的具体用法?Python Feed.feed_url怎么用?Python Feed.feed_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Feed
的用法示例。
在下文中一共展示了Feed.feed_url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_feed_github
# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import feed_url [as 别名]
def add_feed_github(request, user=None):
# if user is None:
# return 'fail'
if request.user.is_authenticated():
user = request.REQUEST['user']
url = 'https://github.com/%s/' % user
feed_url = 'https://github.com/%s.atom' % user
# feed, create = Feed.objects.get_or_create(title=user)
category, created = Category.objects.get_or_create(name='github', slug='github')
feed = Feed()
feed.title = user
feed.url = url
feed.category = category
feed.feed_url = feed_url
feed.dt_checked = datetime.datetime(1, 1, 1, 0, 0, 0)
feed.dt_updated = datetime.datetime(1, 1, 1, 0, 0, 0)
feed.save()
return HttpResponse('yay')
# return HttpResponseRedirect('/admin/reader/feed/%d/' % (feed.id,))
else:
return 'h4axx0r..'
示例2: add_rss
# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import feed_url [as 别名]
def add_rss(request, url=None):
if url is None:
url = request.REQUEST['url']
d = feedparser.parse(url)
feed = Feed()
feed.title = d.feed.get('title', 'Untitled')
feed.url = d.feed.get('link', url[:url.find('/', 8)])
feed.feed_url = url
feed.dt_checked = datetime.datetime(1, 1, 1, 0, 0, 0)
feed.dt_updated = datetime.datetime(1, 1, 1, 0, 0, 0)
feed.save()
update(request, feed.id)
return HttpResponseRedirect('/admin/reader/feed/%d/' % (feed.id,))
示例3: test_create_feed
# 需要导入模块: from models import Feed [as 别名]
# 或者: from models.Feed import feed_url [as 别名]
def test_create_feed(self):
feed = Feed()
feed.feed_url = 'http://www.reddit.com/r/django.rss'
feed.name = 'Django Reddit'
feed.save()