On 12/20/06, k1000 <[EMAIL PROTECTED]> wrote:

Hi. Is there any way to access human column names based on query object

Rails gives them together with query result.  I know U don't like to
compare with it ;) but it would be nice feature.
Probably it's possible to iterate query object and take humanized names
from model definitions?

I'm uncertain exactly what you are asking for here. If you have a model:

class Article(Model):
  title = CharField()

then you can reference article.title, which will reference the 'title'
column in the 'project_article' table of the database. You can
manually specify the use of alternate column names and table names if
you want.

If you want to iterate over the fields of an object, you can use the
Article._meta.fields, which is a list of normal fields; there are
other methods and attributes to iterate over m2m and reverse relation
fields.

Is any of this helping? Can you explain what you want any clearer
(preferably without referring to Rails? I've looked Rails, but I'm not
exactly familiar with all its workings).

Yours,
Russ Magee %-)

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