Re: How to know which fields a model contains?

2008-08-29 Thread Alexis Bellido
That's also a good idea. Thanks Jim. --~--~-~--~~~---~--~~ 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

Re: How to know which fields a model contains?

2008-08-25 Thread Jim D.
I'm pretty new to python myself, but my favorite way to inspect objects that I have found so far is the builtin method dir(). As in: dir(Publisher.objects.get(pk=1)) dir() tells you all of the methods and attributes for a given object, though it doesn't display the value of attributes.

Re: How to know which fields a model contains?

2008-08-25 Thread Alexis Bellido
Thanks everybody, using __dict__ and meta_fields helped but the most complete data came from the documentation in admin, that's exactly what I needed :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: How to know which fields a model contains?

2008-08-21 Thread jason
You could use this: Publisher.objects.get(pk=1).__dict__ The admin application is also great for this! :) Best Regards, Jesaja Everling On Aug 21, 10:55 pm, Erik Allik <[EMAIL PROTECTED]> wrote: > Do you mean something like Publisher._meta.fields? > > Erik > > On 21.08.2008, at 22:38, Alexis

Re: How to know which fields a model contains?

2008-08-21 Thread Erik Allik
Do you mean something like Publisher._meta.fields? Erik On 21.08.2008, at 22:38, Alexis Bellido wrote: > > Hello, I'm reading the Django book and after reviewing the database > API I was wondering if there was some method to find out which fields > a model contains. > > For example, if I have

Re: How to know which fields a model contains?

2008-08-21 Thread [EMAIL PROTECTED]
On Aug 21, 2:38 pm, Alexis Bellido <[EMAIL PROTECTED]> wrote: > Hello, I'm reading the Django book and after reviewing the database > API I was wondering if there was some method to find out which fields > a model contains. If I'm understanding the question, why not just use the documentation

How to know which fields a model contains?

2008-08-21 Thread Alexis Bellido
Hello, I'm reading the Django book and after reviewing the database API I was wondering if there was some method to find out which fields a model contains. For example, if I have a Publisher model (which translates to a publisher table in the database) I'm looking for some method in Django