我想从FeedSource类模型中检索网址,以将提要保存在我的网站中
在 models.py
中 var $reservationBtn= $("#js-reservation-btn");
// Don't send form to it's page, but redirect user to Contact page
function redirect_form_to_contact_page() {
$reservationBtn.on('click', function(e) {
e.preventDefault();
window.location.href = 'https://www.example.com/contact';
});
}
// Reset form so it works normally
function reset_form() {
$reservationBtn.on('click', function(e) {
return true;
});
}
// Depending on a tab clicked redirect to Contact or reset form
$("#reservation__list a").click(function() {
if ($(this).hasClass('js-reservation-tab-btn-camp')) {
redirect_form_to_contact_page();
}
else {
reset_form();
}
});
在 apps.py
中 class FeedSource(models.Model):
url = models.URLField(max_length=400, blank=True)
is_active = models.BooleanField(default=False)
class Feed(models.Model):
feedsource = models.ForeignKey(FeedSource, on_delete=models.CASCADE, null=True)
author = models.CharField(max_length=250)
我希望输出从FeedSource模型中检索URL并将提要保存在我的站点中。但是我已经通过手动网址做到了:
from feed.models import Feed, FeedSource
import feedparser
d = feedparser.parse('http://feeds.feedburner.com/abc/')