Go to file
Bert Constantin 7e584632b8 fix unnecessary field-name/model-name conflicts (i.e. field_name == model_name.lower() )
=> __init__ + __getattribute__ now handle only the Django inheritance
references that are needed ('modela_ptr', 'modelc' etc.), avoiding
unnecessary conflicts with field names.
2010-02-18 20:05:17 +01:00
pexp fix remaining potential accessor name clashes (but this only works with Django 1.2+, for 1.1 no changes). Thanks to Andrew Ingram. 2010-02-04 15:28:49 +01:00
polymorphic fix unnecessary field-name/model-name conflicts (i.e. field_name == model_name.lower() ) 2010-02-18 20:05:17 +01:00
.gitignore fix unnecessary field-name/model-name conflicts (i.e. field_name == model_name.lower() ) 2010-02-18 20:05:17 +01:00
AUTHORS setup.py added. Thanks to Andrew Ingram. 2010-02-04 15:28:56 +01:00
DOCS.rst some doc + minor code updates (__repr__ + Show... mixins) 2010-02-18 20:04:38 +01:00
LICENSE updated docs, and moved them to DOCS.rst and README.rst 2010-01-26 14:28:22 +01:00
README.rst some doc + minor code updates (__repr__ + Show... mixins) 2010-02-18 20:04:38 +01:00
__init__.py initial commit 2010-01-15 21:13:36 +01:00
dbreset Restructured django_polymorphic into a regular add-on application. 2010-01-29 13:41:19 +01:00
manage.py fix "manage.py dumpdata", by adding polymorphic_dumpdata command (github issue 4) 2010-01-29 00:02:27 +01:00
settings.py Restructured django_polymorphic into a regular add-on application. 2010-01-29 13:41:19 +01:00
setup.py setup.py added. Thanks to Andrew Ingram. 2010-02-04 15:28:56 +01:00

README.rst

Release Notes, Usage, Code
--------------------------

* Please see `here for release notes, news and discussion`_ (Google Group)
* `Many Examples`_, or full `Installation and Usage Docs`_ (or the short `Overview`_)   
* Download from GitHub_ or Bitbucket_, or as TGZ_ or ZIP_
* Improve django_polymorphic: Report issues, discuss, post patch, or fork the code (GitHub_, Bitbucket_, Newsgroup_, Mail_) 

.. _here for release notes, news and discussion: http://groups.google.de/group/django-polymorphic/topics
.. _Newsgroup: http://groups.google.de/group/django-polymorphic/topics
.. _Mail: http://github.com/bconstantin/django_polymorphic/tree/master/setup.py
.. _Installation and Usage Docs: http://bserve.webhop.org/wiki/django_polymorphic/doc
.. _Many Examples: http://bserve.webhop.org/wiki/django_polymorphic/doc#defining-polymorphic-models
.. _GitHub: http://github.com/bconstantin/django_polymorphic
.. _Bitbucket: http://bitbucket.org/bconstantin/django_polymorphic
.. _TGZ: http://github.com/bconstantin/django_polymorphic/tarball/master
.. _ZIP: http://github.com/bconstantin/django_polymorphic/zipball/master
.. _Overview: http://bserve.webhop.org/wiki/django_polymorphic


What is django_polymorphic good for?
------------------------------------

**Example**: If we define the model ``Project`` as the base class for
our models ``ArtProject`` and ``ResearchProject``, and we store one of
each into the database, then we can do::

	>>> Project.objects.all()
	.
	[ <Project:         id 1, topic: "John's Gathering">,
	  <ArtProject:      id 2, topic: "Sculpting with Tim", artist: "T. Turner">,
	  <ResearchProject: id 3, topic: "Swallow Aerodynamics", supervisor: "Dr. Winter"> ]

In general: django_polymorphic implements seamless polymorphic inheritance for Django models.

The effect: objects are always returned back from the database just
as you created them, with the same type/class and fields.

It doesn't matter how these objects are retrieved: be it through the
model's own managers/querysets, ForeignKeys, ManyToManyFields
or OneToOneFields.

As seen in this example, the resulting querysets are polymorphic,
and will typically deliver objects of several different types in
a single query result.

django_polymorphic does this only for models that explicitely enable it
(and for their submodels).

Please see the `Documentation and Examples`_ for more information
or directly look at `more Examples`_. 

.. _Documentation and Examples: http://bserve.webhop.org/wiki/django_polymorphic/doc
.. _more Examples: http://bserve.webhop.org/wiki/django_polymorphic/doc#defining-polymorphic-models

Status
------

It's important to consider that this code is very new and
to some extent still experimental. Please see the docs for
current restrictions, caveats, and performance implications.

It does seem to work very well for a number of people, but
API changes, code reorganisations or further schema changes
are still a possibility. There may also remain larger bugs
and problems in the code that have not yet been found.


License
-------

django_polymorphic uses the same license as Django (BSD-like).


Database Schema Change on January 26
------------------------------------

| The update from January 26 changed the database schema (more info in the commit-log_).
| Sorry for any inconvenience. But this should be the final DB schema now.

.. _commit-log: http://github.com/bconstantin/django_polymorphic/commit/c2b420aea06637966a208329ef7ec853889fa4c7