Sorry My opera mail down....It makes sth wrong to send out 3 mails I'm too late to stop it
Thanks for helping me
在 Mon, 24 May 2010 02:08:34 +0800,Daniel Roseman <dan...@roseman.org.uk> 写道:

On May 23, 6:39 pm, 伟泓 徐 <eternalstrikefree...@hotmail.com> wrote:
class People(models.Model):
    GenderChoice=(
        (u'M', u'Male'),
        (u'F', u'Female'),
    )
    PositionChoice=(
        (u'S',u'Student'),
        (u'A',u'Admin'),
    )
    Schoolnum=models.IntegerField(primary_key=True)
    Gender=models.CharField(max_length=100,choices=GenderChoice)
    Name=models.CharField(max_length=100)
    Birthday=models.DateField()
    Age=models.IntegerField()
    Email=models.EmailField(blank=True)
    Password=models.CharField(max_length=100)
    Position=models.CharField(max_length=100,choices=PositionChoice)
    CellPhoneNumber=models.IntegerField(max_length=11)
    HeadImage=models.ImageField(upload_to='c:\website\photos')
    def __unicode__(self):
        return self.Name
    def meta(self):
        ordering=['Name']
        abstract=True

class Comment(models.Model):
    CommentSchoolNum=models.ForeignKey('People')
    CommentWord=models.TextField()
    CommentTime=models.DateField()
    def __unicode__(self):
        return self.CommentWord

why I cannot use such sentense:
s=People.objects.filter(Position='A')
s.comment_set.all()

The django says that the queryset does not have the attribution comment_set.Why?


Not sure why you needed to post this question three times.

`s` is a queryset, composing a number of People objects. So it doesn't
itself have a comment_set attribute - neither does it have Schoolnum
or Gender. It's the *members* of the s queryset that have these
atttributes.
--
DR.



--
吾血之血啊

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to