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 [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
-~----------~----~----~----~------~----~------~--~---