First I must admit that I'm a databse dummy.  I'm using fairly recent
django code from svn.  I have a simple desire.  I want people who can
be organized into committees, with each committee having a committee
leader, also a person.  I wrote up my models like so:

class Person( models.Model ):
    firstname = models.CharField( maxlength=200 )
    lastname = models.CharField( maxlength=200 )
    email = models.EmailField()
    phone_number = models.PhoneNumberField()
    committee = models.ForeignKey( 'Committee' )
    notes = models.TextField()

    def __str__( self ):
        return self.firstname + " " + self.lastname

    class Admin:
        pass

class Committee( models.Model ):
    name = models.CharField( maxlength=200 )
    leader = models.ForeignKey( Person,
                                related_name = 'commitee_leading' )
    notes = models.TextField()

    def __str__( self ):
        return self.name + " Committee"

    class Admin:
        pass

In the shell, this all seems to work OK, but when I use the admin app,
and click to add a person, I get this:

Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
in get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py"
in _checklogin
  55. return view_func(request, *args, **kwargs)
File "/home/bryan/web/django_src/django/views/decorators/cache.py" in
_wrapped_view_func
  40. response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py"
in add_stage
  246. manipulator = model.AddManipulator()
File "/home/bryan/web/django_src/django/db/models/manipulators.py" in __init__
  75. self.fields.extend(f.get_manipulator_fields(self.opts, self,
self.change, fol))
File "/usr/lib/python2.4/site-packages/django/db/models/related.py" in
get_manipulator_fields
  116. if follow.get(f.name, False):

  AttributeError at /admin/organizer/person/add/
  'bool' object has no attribute 'get'

I get something very similar if I create a Person in the shell, and
then try and view that person through the admin app.  Any ideas?  The
docs say that using the string argument to ForeignKey() is buggy, is
that what I'm seeing?  Is there a better way to model and keep track
of committee leaders?

Thanks,

Bryan

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