On Oct 30, 2008, at 7:04 PM, [EMAIL PROTECTED] wrote:
> > Hi, > i hope any one can help me. > I want to generate a rss-feed. > The url ist http://localhost:8000/isf/info/. > All works fine but the title of an Item and the Description are still > the same! > How can i change the title of an feed item in the feed to the title > from the model > and the description of the feed item to the description from the > model. > I get only the String from the __unicode__(self): Method. An this > string represent > the title and the description, why ? You need to provide some templates in order to display the feed items as you want them to look, check out the documentation here: http://docs.djangoproject.com/en/dev/ref/contrib/syndication/#a-simple-example > > > Please help me! > > > > My urls.py config: > feeds = { > 'rss': Rss2Feed, > > } > > urlpatterns = patterns('django.contrib.syndication.views', > url(r'^(?P<url>.*)/$', 'feed', {'feed_dict': feeds}, > name="fh_feeds",), > ) > > Thats my models.py class: > > class Item(models.Model): > title = models.CharField(max_length=30) > banner = models.CharField(max_length=30, null=True) > description = models.TextField(null=True) > pub_date = models.DateTimeField(auto_now=True, > verbose_name="Public Date") > expire_date = models.DateTimeField(verbose_name="Expire Date") > author = models.ForeignKey(User, editable=False) > > def authors_email(self): > return "%s"%(self.author.email) > > def get_absolute_url(self): > return "%s/"%(self.id) > > def __unicode__(self): > return self.title > > class Meta: > ordering = ['-pub_date'] > > class Item_Category(models.Model): > item = models.ForeignKey(Item) > category = models.ForeignKey(Category) > > def __unicode__(self): > return "%s"%self.item.id > > And thats my feed.py class: > > class Rss2Feed(Feed): > #thats my hard-coded title,link and description for my info feed > title = "Info" > link = "/info/" > description = "Info-Site" > > # i want to show all items of my model with the slug info > def items(self): > listOfItems = [] > itemToCategoryForInfo = > Item_Category.objects.select_related().filter(category__slug = "info") > for selectedItem in itemToCategoryForInfo: > listOfItems.append(selectedItem.item) > return listOfItems You can return a queryset directly here, all you need is: def items(self): return Item_Category.objects.select_related().filter(category__slug = "info") > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

