Hi folks,

I'm trying to develop an application that 'extends' the User object.
I'm using the 'related_name' argument for ForeignKey to access the
related objects through request.user

I have a class, similar to this
==========
class Foo(models.Model):
        user = models.ForeignKey(User, edit_inline=models.TABULAR unique-True,
related_name='foo')

        def __str__(self):
                return "Foo ID#%s" % self.id

        def some_function(self):
                return "Result"
==========

If I try to display the relationship, I'd expect to get 'Foo ID#1', but
I get this...
==========
print "User's Foo: %s" % request.user.foo
        <django.db.models.fields.related.RelatedManager object at 0x79e2d0>
==========

When I try to traverse the reference, I can't access any of the
functions or attributes
==========
request.user.foo.some_function()
        AttributeError at /foos/1/
        'RelatedManager' object has no attribute 'some_function'
==========

Am I doing something wrong? Making an incorrect assumption about the
functionality of Django?

Any insight would be appreciated! Thanks!
  --Ben


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to