Re: Displaying my table data

2007-05-24 Thread Kelvin Nicholson
c = Choice.objects.filter(choice=1) c > [, , ] c.size.name > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'QuerySet' object has no attribute 'size' > > I still can't access the size and price's tied to style number 89b. I > thought that c.size.nam

RE: Displaying my table data

2007-05-23 Thread Chris Brand
> >>> from mysite.rugs.models import Choice, Size, Price > >>> c = Choice.objects.filter(choice=1) > >>> c > [, , ] You can see here that your queryset maps to three objects. > >>> c.size.name > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'QuerySet' object has

Re: Displaying my table data

2007-05-23 Thread Greg
Carole, I've tried what you suggeted and it still didn't work. I haven't changed my db structure. Here is what I get when I do it in the command prompt >>> from mysite.rugs.models import Choice, Size, Price >>> c = Choice.objects.filter(choice=1) >>> c [, , ] >>> c.size.name Traceback (most rec

Re: Displaying my table data

2007-05-23 Thread [EMAIL PROTECTED]
Ok...then it would be soemthing like this: choices = Choice.objects.filter(choice=1) for choice in choices: # you used filter, not get so I'm assuming this is not the primary key and you are getting multiple objects back a.size.name a.price.name However...if your size/price tables all jus

Re: Displaying my table data

2007-05-23 Thread [EMAIL PROTECTED]
Ok...then it would be soemthing like this: choices = Choice.objects.filter(choice=1) for choice in choices: # you used filter, not get so I'm assuming this is not the primary key and you are getting multiple objects back a.size.name a.price.name However...if your size/price tables all jus

Re: Displaying my table data

2007-05-23 Thread [EMAIL PROTECTED]
Ok...then it would be soemthing like this: choices = Choice.objects.filter(choice=1) for choice in choices: # you used filter, not get so I'm assuming this is not the primary key and you are getting multiple objects back a.size.name a.price.name However...if your size/price tables all jus

Re: Displaying my table data

2007-05-23 Thread [EMAIL PROTECTED]
Ok...then it would be soemthing like this: choices = Choice.objects.filter(choice=1) for choice in choices: # you used filter, not get so I'm assuming this is not the primary key and you are getting multiple objects back a.size.name a.price.name However...if your size/price tables all jus

Re: Displaying my table data

2007-05-22 Thread Greg
Yea, I'm not sure why I used choice as the field name. I probably should of used style. Anyway, here are all my models class Size(models.Model): name = models.CharField(maxlength=100) def __str__(self,): return self.name class Admin: pas

Re: Displaying my table data

2007-05-22 Thread [EMAIL PROTECTED]
What does the model code look like for Size,Price? Also, choice = models.ForeignKey(Style, edit_inline=models.TABULAR,num_in_admin=5) Did you mean for that to be: style = models.ForeignKey(Style, edit_inline=models.TABULAR,num_in_admin=5) Just curious..as then it would be consistent with the

Re: Displaying my table data

2007-05-22 Thread Greg
Vance, Ok...that worked. However, I have a new problem. I'm not sure how to display all the sizes and colors of a particular rug. In my shell python I do the following >>> a = Choice.objects.filter(choice=1) >>> a [, , ] >>> What do I need to type into the shell prompt to get all the sizes an

Re: Displaying my table data

2007-05-22 Thread Greg
Vance, Ok...that worked. However, I have a new problem. I'm not sure how to display all the sizes and colors of a particular rug. In my shell python I do the following >>> a = Choice.objects.filter(choice=1) >>> a [, , ] >>> What do I need to type into the shell prompt to get all the sizes an

Re: Displaying my table data

2007-05-22 Thread Vance Dubberly
My bet would be that this little bit of code right here: def __str__(self,): return self.choice the return of __str__ needs to be a string not an object. Vance On 5/21/07, Greg <[EMAIL PROTECTED]> wrote: > > I am trying to display the table in my Choice table. However it's > error's ou

Displaying my table data

2007-05-21 Thread Greg
I am trying to display the table in my Choice table. However it's error's out everytime I try to see the contents of the table. In my python shell prompt I do the following and get the error C:\django\mysite>python manage.py shell (InteractiveConsole) >>> from mysite.rugs.models import Choice >