OK, I'm a Python/Django newbie (more or less), and I have a problem.

I had these two models (details stripped for clarity:

class School(models.Model):
    ...
    name = models.CharField()
    street = models.CharField()
    mail = models.CharField()
    city = models.CharField()
    state = models.USStateField()
    zip = models.CharField()
    plus_four = models.CharField()
    phone = models.PhoneNumberField()
    fax = models.PhoneNumberField()
    NCESSID = models.CharField()
    ...
    def __str__(self):
        return self.name

class SchoolPersonnel(models.Model):
    ...
    school = models.ForeignKey('School')
    honorific = models.CharField()
    title = models.CharField()
    first_name = models.CharField()
    last_name = models.CharField()
    email = models.EmailField()
    phone = models.PhoneField
    ...
    def __str__(self):
    return '%s, %s' % (self.last_name, self.first_name)


I want a page that will list the school details and include all the
personnel associated with that school. Like this:

Some High School
Address
City, Sate zip

Phone
Fax

Personnel
Mr. Smith Principal [EMAIL PROTECTED]
Mrs. Williams Counselor [EMAIL PROTECTED]
Etc.

I've tried using School.schoolpersonnel_set.all() but you can't access the
details (i.e. School.schoolpersonnel_set.objects.title) because the
"'RelatedManager' object has no attribute 'objects'".

I've tried to iterate through School.schoolpersonnel_set.all(), on the
template, but I can't figure out what the instances of
School.schoolpersonnel_set.all() are called.

{% for SchoolPersonnel in School.schoolpersonnel_set %} gives me an
"iteration over non-sequence" error.

I've tried a bunch of other things that don't work either.

I know that there is something in School.schoolpersonnel_set but I don't
know how to get it onto the web page.

I've been working on this for about a week now. I've looked through the
documentation, the django book, and the archives of this list. I've even
tried looking at code from other applications, but I can't seem to find
anything on point.

Can anyone help me?

-- 
Pgb




--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to