You should be doing
>>> p = Profile.objects.get(id=1)    #or .get(1) or one of the many other 
>>> posibilities

filter returns a list of the results, in the case of id=# it probably
returns only one, but it's still a list of one member.

So in your case it would work if you did this:
>>>p= Profile.objects.filter(id=1)
>>>print p[0]

On Aug 2, 1:35 am, james_027 <[EMAIL PROTECTED]> wrote:
> hi,
>
> i am trying to use the manage.py shell, for fast testing of what I
> would like to do.
>
> I have a model like this
>
> class Function(models.Model):
>     """Functions that KSK Employee account could use"""
>
>     name = models.CharField(maxlength=40)
>     url = models.CharField(maxlength=40, default='/')
>     method = models.CharField(maxlength=40, default='index')
>
> class Profile(models.Model):
>     """KSK Employee accounts to use this application"""
>
>     user = models.ForeignKey(User, unique=True)
>     department = models.CharField(maxlength=3,
> choices=DEPARTMENT_LIST)
>     level = models.CharField(maxlength=2, choices=LEVEL_LIST)
>     functions = models.ManyToManyField(Function, blank=True)
>
> when I do in the shell
>
> >>>p = Profile.objects.filter(id=1)
> >>>p
>
> [<Profile: james>]
> but when I did this>>>p.department
>
> it say
> AttributeError: '_QuerySet' object has no attribute 'level'
>
> is there anything I should know?
>
> THanks
> james


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