On Jun 5, 2013, at 12:56 PM, Cal Leeming [Simplicity Media Ltd] wrote:

> Hello,
> 
> The following;
>     class Meta:
>         ordering = ('hostname')
> 
> Results in;
> amber.reseller: "ordering" refers to "h", a field that doesn't exist.
> amber.reseller: "ordering" refers to "o", a field that doesn't exist.
> amber.reseller: "ordering" refers to "s", a field that doesn't exist.
> amber.reseller: "ordering" refers to "t", a field that doesn't exist.
> amber.reseller: "ordering" refers to "n", a field that doesn't exist.
> amber.reseller: "ordering" refers to "a", a field that doesn't exist.
> amber.reseller: "ordering" refers to "m", a field that doesn't exist.
> amber.reseller: "ordering" refers to "e", a field that doesn't exist.
> 
> To fix this, I have to use;
>     class Meta:
>         ordering = ('hostname', )
> 
> However in python cli;
> 
> salt1 foxx # python
> Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) 
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> ['hostname']
> ['hostname']
> >>> lol = ['hostname']
> >>> lol[0]
> 'hostname'
> >>> lol[1]
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> IndexError: list index out of range
> 
> Could anyone please explain why Django is not treating this list/tuple 
> properly?

(x) isn't a tuple for the same reason (x+1)*4 isn't a tuple. (x,) is a tuple of 
one item.

--Noah

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to