okay that's great but is there a way to get the list of fields from a
model instance instead of from the Model class itself?
My thought is that if I pass in the list of model instance into the
template, the order should be still there. so why pass in another
variable which contains the model fields
On 8/6/2010 1:34 PM, owidjaya wrote:
> is there a way that i can get the a list of dictionaries as a result
> with the dictionary having the same field order as the table?
>
What do you regard as the "field order" of the dictionary? If you are
talking about the order Python iterates over the field
You can't use a dictionary if you expect a certain order of key/value pairs.
Given model A you could get a list of field objects in the same order (I
think) as defined in the model class
A._meta.fields
At least with that information you could programatically produce a list of
data in matching or
is there a way that i can get the a list of dictionaries as a result
with the dictionary having the same field order as the table?
On Aug 6, 10:18 am, Daniel Roseman wrote:
> On Aug 6, 6:08 pm, owidjaya wrote:
>
> > I checked it and the field order still not the same.
> > Just to clarify. I want
On Aug 6, 6:08 pm, owidjaya wrote:
> I checked it and the field order still not the same.
> Just to clarify. I want the to do this A.objects.all().values()
> and still get the each list in the result to have the same "field
> order" as the database table defined.
`values()` returns a set of dicti
I checked it and the field order still not the same.
Just to clarify. I want the to do this A.objects.all().values()
and still get the each list in the result to have the same "field
order" as the database table defined.
On Aug 6, 9:57 am, kostia wrote:
> use table = ModelName.objects.all().order
use table = ModelName.objects.all().order_by("filter_name")
It is ordered by id field apriori.
--
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, s
Hi All,
I was just wondering is there a way to get queryset to return result
of a database lookup
to list the fields in the same order as it is defined in the database
table?
so for example in my
TABLE A
--
A
B
C
the query set result will return
exactly
[ {A: some value, B: some value,
8 matches
Mail list logo