Luka
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Hi Luka,
I get the object attributes and their values with __dict__, It's not
enough for your case?
>>> Domain.objects.all()[1].__dict__
{'name_ptr_id': 2L, 'name': u'pangea', 'extension': u'org',
'slave_refresh': u'1d', 'min_caching_time': u'1h', '_state':
<django.db.models.base.ModelState object at 0x3351090>, 'is_mail':
False, 'slave_retry': u'2h', 'is_hosted': False, 'expire':
datetime.date(2012, 7, 31), 'active': True, 'is_purchased': False,
'slave_expiration': u'4w', 'id': 2L, 'serial': 203308L}
--
Marc
I know I'm a bit late to the party (blame timezones :), but thought
I'd put my 2 cents worth in :)
For inspecting models from command lines (usually when working with
models from legacy databases) I often use model_to_dict which is
"hidden" in django.forms.models.
>>> from django.forms.models import model_to_dict
>>> print model_to_dict(some_model)
HTH
Jirka
import pdb; pdb.set_trace();
To my code.
Reload the page.
Go to the development server instance. You'll see that the page hangs forever ,since we started the python debugger.
Now you can easily inspect all variables, classes and functions from PDB.
Of course you're not limited to using set_trace().
Good luck !
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
Jonas Geiregat
jo...@geiregat.org
>> Thank you all for your help!!!
>
> I know I'm a bit late to the party (blame timezones :), but thought
> I'd put my 2 cents worth in :)
>
> For inspecting models from command lines (usually when working with
> models from legacy databases) I often use model_to_dict which is
> "hidden" in django.forms.models.
This is new for me. I've noticed before that django's API docs doesn't all function available. There's probably a good reason for it.
What's the advantage of using model_to_dict against dict(some_queryset) ?
Can be split into its own page another day