Re: Basic RSS in Django

2009-04-15 Thread Jeff FW

It looks like you're missing (or at least, didn't mention) the
templates. In documentation:

http://docs.djangoproject.com/en/dev/ref/contrib/syndication/#ref-contrib-syndication

make sure to read the paragraph starting with "One thing's left to do"
under "A simple example".

-Jeff

On Apr 15, 8:30 am, Oto Brglez  wrote:
> Hi all you Django users and developers!
>
> I have a question about RSS framework in Django. I want basic RSS.
> Nothing custom nothing advanced. Just RSS from my model for last 10
> imports in model. This is what i got:
>
> # Model:
>
> class Koda(models.Model):
>         naslov = models.CharField(max_length=50)
>         slug = models.SlugField(max_length=255,blank=True,null=True)
>         koda = models.TextField()
>         dodano = models.DateTimeField(default=datetime.datetime.now ,
> blank=True)
>         avtor = models.ForeignKey(User)
>
>         @permalink
>         def get_absolute_url(self):
>                 return ('koda_view', [self.slug])
>
>         def __unicode__(self):
>                 return self.jezik.ime + ' / '+ self.naslov
>
> #  RSS Model:
>
> class SvezaKoda(Feed):
>         title = "Rss title..."
>         link = "/rss/"
>         description = "Description..."
>
>         def items(self):
>                 return Koda.objects.order_by('-dodano')[:10]
>
>         def item_link(self,item):
>                 return '/'+ item.jezik.slug + '/' + item.slug
>
>         def item_author_name(self,item):
>                 return item.avtor
>
>         def item_pubdate(self,item):
>                 return item.dodano
>
> # URLs:
>
> feeds = {
>     'koda': SvezaKoda,
>
> }
>
> urlpatterns = patterns('',
>         (r'^rss/(?P.*)/$', 'django.contrib.syndication.views.feed',
> {'feed_dict': feeds}),
> ...
>
> ---
>
> Now. This works. But in content field i don't get content that i want.
> I want the field "koda" to be shown inside RSS content field. Insted
> of the content inside rss item i get value of __unicode__
>
> Can someone please help me.
>
> Oto
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Basic RSS in Django

2009-04-15 Thread Oto Brglez

Thanx Jeff!

it works now ;)

Oto

On 15 apr., 15:25, Jeff FW  wrote:
> It looks like you're missing (or at least, didn't mention) the
> templates. In documentation:
>
> http://docs.djangoproject.com/en/dev/ref/contrib/syndication/#ref-con...
>
> make sure to read the paragraph starting with "One thing's left to do"
> under "A simple example".
>
> -Jeff
>
> On Apr 15, 8:30 am, Oto Brglez  wrote:
>
> > Hi all you Django users and developers!
>
> > I have a question aboutRSSframework in Django. I want basicRSS.
> > Nothing custom nothing advanced. JustRSSfrom my model for last 10
> > imports in model. This is what i got:
>
> > # Model:
>
> > class Koda(models.Model):
> >         naslov = models.CharField(max_length=50)
> >         slug = models.SlugField(max_length=255,blank=True,null=True)
> >         koda = models.TextField()
> >         dodano = models.DateTimeField(default=datetime.datetime.now ,
> > blank=True)
> >         avtor = models.ForeignKey(User)
>
> >         @permalink
> >         def get_absolute_url(self):
> >                 return ('koda_view', [self.slug])
>
> >         def __unicode__(self):
> >                 return self.jezik.ime + ' / '+ self.naslov
>
> > #  RSSModel:
>
> > class SvezaKoda(Feed):
> >         title = "Rsstitle..."
> >         link = "/rss/"
> >         description = "Description..."
>
> >         def items(self):
> >                 return Koda.objects.order_by('-dodano')[:10]
>
> >         def item_link(self,item):
> >                 return '/'+ item.jezik.slug + '/' + item.slug
>
> >         def item_author_name(self,item):
> >                 return item.avtor
>
> >         def item_pubdate(self,item):
> >                 return item.dodano
>
> > # URLs:
>
> > feeds = {
> >     'koda': SvezaKoda,
>
> > }
>
> > urlpatterns = patterns('',
> >         (r'^rss/(?P.*)/$', 'django.contrib.syndication.views.feed',
> > {'feed_dict': feeds}),
> > ...
>
> > ---
>
> > Now. This works. But in content field i don't get content that i want.
> > I want the field "koda" to be shown insideRSScontent field. Insted
> > of the content insiderssitem i get value of __unicode__
>
> > Can someone please help me.
>
> > Oto
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---