Hello,
Just learning about Django, and I would like to know what the best
way to generate a table from my data, similar to what the "admin" app
does. I attempted to dig into the source of the admin app, but I was
unable to achieve much.
I don't want to create a template that has for loops that l
On Saturday 17 July 2010 12:30:19 david wrote:
> Just learning about Django, and I would like to know what the best
> way to generate a table from my data, similar to what the "admin" app
> does. I attempted to dig into the source of the admin app, but I was
> unable to achieve much.
>
> I don't
Each model has a meta attribute with a list of fields on it; for a
Photo model, for example, you can use Photo._meta.fields.
This means you could do something (at least in the shell) like:
>>> fields = Photo._meta.fields
>>> photo = Photo.objects.latest()
>>> for field in fields:
... print '%
David,
The best thing to do is use the Django docs, maybe do their tutorial.
The link below should get you there:
http://docs.djangoproject.com/en/1.2/
~Carl
On Jul 17, 3:00 am, david wrote:
> Hello,
> Just learning about Django, and I would like to know what the best
> way to generate a ta
Yes, I finished the tutorial, and it was very informative, but I could
not find in the documentation anything about getting fields from a
model, like Justin had suggested.
It seems like his solution might work, but it seems a bit hackish
(underscores mean private data right?). I wonder if thats how
5 matches
Mail list logo