Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 March 25, 2008 06:45:32

h.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django RSS


------------------------from Model file------------------------
...
class A(models.Model):
B = models.AutoField(primary_key=True)
C = models.CharField(max_length=5)
D = models.CharField(blank=True, max_length=255)
def __unicode__(self):
return unicode( self.Description )
class Admin:
pass
class Meta:
db_table = 'A'
...

------------------------contents of a file named
A------------------------
from django.contrib.syndication.feeds import Feed
from Application.Project.models import A

class A(Feed):
title = "Title"
link = "/A/"
description = "RSS test"

def items(self):
return A.objects.order_by('B')

I don't have a view for this. If one is needed, I could write one
up. I was under the impression that I didn't need one to get an RSS
reader to do it's thing.



On Mar 20, 1:55 am, Malcolm Tredinnick <>
wrote:
> On Wed, 2008-03-19 at 10:27 -0700, howaldmg wrote:
> > object has no attribute 'get_feed'
>
> > I have followed every tutorial I could find to get a simple RSS feed
> > working. This is the location of the problem:
>
> > /home/32358/data/python/django/django/contrib/syndication/views.py in
> > feed
>
> > 12. try:
> > 13. f = feed_dict
> > 14. except KeyError:
> > 15. raise Http404, "Slug %r isn't registered." % slug
> > 16. try:
>
> > 19. feedgen = f(slug, request).get_feed(param) ...
>
> > 20. except feeds.FeedDoesNotExist:
> > 21. raise Http404, "Invalid feed parameters. Slug %r is valid, but
> > other parameters, or lack thereof, are not." % slug
> > 22. response = HttpResponse(mimetype=feedgen.mime_type)
> > 23. feedgen.write(response, 'utf-8')
> > 24. return response
>
> > no tutorial actually says anything about providing a get_feed method.
>
> The get_feed() method is defined on the Feed class that your feed class
> must inherit from. Normally, it would be easier to debug a problem like
> this if you could provide a short code sample that demonstrates the
> problem. This doesn't mean giving away confidential information -- just
> construct a small case that displays the same problem and changes the
> names from the original. If I had to guess I would say the object
> returned from the feed dictionary for this particular slug doesn't
> inherit from django.contrib.syndication.feeds.Feed.
>
> Regards,
> Malcolm
>
> --
> He who laughs last thinks slowest.http://www.pointy-stick.com/blog/--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#2 March 25, 2008 08:57:13

Malcolm T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django RSS


On Mon, 2008-03-24 at 22:45 -0700, howaldmg wrote:
> ------------------------from Model file------------------------
> ...
> class A(models.Model):
> B = models.AutoField(primary_key=True)
> C = models.CharField(max_length=5)
> D = models.CharField(blank=True, max_length=255)
> def __unicode__(self):
> return unicode( self.Description )
> class Admin:
> pass
> class Meta:
> db_table = 'A'
> ...
>
> ------------------------contents of a file named
> A------------------------
> from django.contrib.syndication.feeds import Feed
> from Application.Project.models import A
>
> class A(Feed):
> title = "Title"
> link = "/A/"
> description = "RSS test"
>
> def items(self):
> return A.objects.order_by('B')

Namespaces are your friend. Use them. You have two things called 'A'
here.

You've import 'A' from Application.Project.models and also created
something called 'A' in the module itself. That's going to lead to
trouble, because referring to "A" might not be what you expect it to be
(it will always refer to the feed subclass in this case). Instead import
models from Application.Project and then refer to models.A. Or just
choose a more descriptive name for your feed class (e.g. AFeed).

Once you've fixed that problem, if you're still seeing the error you
report, what does the corresponding line in url configuration file look
like (i.e. how are you dispatching from a URL to this feed)?

The class you've defined above does have a get_feed() method, so there's
no problem there (unless your Django checkout is corrupt, which would
raise other errors before this one, I'm sure). so it's either the typo
you've made with name collisions or something else about your setup.

Malcolm


--
The only substitute for good manners is fast reflexes.http://www.pointy-stick.com/blog/--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

Board footer

Moderator control

Enjoy the 11th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support