How do I select the base class from the child object in Django (using model inheritance) -


i have base model , 1 inherits it, similar in setup this:

class archive(models.model):     pub_date = models.datefield()   class archiveb(archive):     another_date = models.datefield() 

how access base class child class? example:

archiveb_instance = archiveb.objects.get(pk=5)  base_instance = archiveb_instance.archive #this doesn't work. 

according documentation one-to-one relationship automatically created in child figured let me go backwards. reason want because have third non-archive model has foreignkey archive. want foreignkey archive because way third model can relate archive, not specific archive type.

i think might looking archiveb_instance.archive_ptr


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -