Hope this helps.
>>> _r = SessionIP.objects.get(id=1000)
# figured this out by doing dir(_r._meta)
>>> _r._meta.db_table
'ddcms_sessionip'
# figured this out by looking at https://docs.djangoproject.com/en/dev/topics/db/multi-db/
>>> _r._state.db
'nats_rw'
Cal
2011/9/27 Juan Pablo Romero Méndez <jpablo.romero@gmail.com>
Hello,
Suppose I get an object from a non-default database:
ob = MyModel.objects.using('somedb').get(pk=1)
Is it possible later to retrieve the database name just from the object?
ob.db??
Regards,
Juan Pablo
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment