All Projects → django-polymorphic → Django Polymorphic

django-polymorphic / Django Polymorphic

Licence: other
Improved Django model inheritance with automatic downcasting

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Django Polymorphic

Django Nested Admin
Django admin classes that allow for nested inlines
Stars: ✭ 463 (-59.21%)
Mutual labels:  django, django-admin
Django Admin Bootstrap
Responsive Theme for Django Admin With Sidebar Menu
Stars: ✭ 787 (-30.66%)
Mutual labels:  django, django-admin
Django Ordered Model
Get your Django models in order
Stars: ✭ 476 (-58.06%)
Mutual labels:  django, django-admin
Django Cruds Adminlte
django-cruds is simple drop-in django app that creates CRUD for faster prototyping
Stars: ✭ 373 (-67.14%)
Mutual labels:  django, django-admin
Requery
Store e run queries on database to help system manager of a Django website
Stars: ✭ 12 (-98.94%)
Mutual labels:  django, django-admin
Django Object Actions
A Django app for easily adding object tools in the Django admin
Stars: ✭ 374 (-67.05%)
Mutual labels:  django, django-admin
Awesome Django
The Best Django Resource, Awesome Django for mature packages.
Stars: ✭ 591 (-47.93%)
Mutual labels:  django, django-admin
Django Admin Easy
Collection of admin fields and decorators to help to create computed or custom fields more friendly and easy way
Stars: ✭ 265 (-76.65%)
Mutual labels:  django, django-admin
Django Oml
Object Moderation Layer
Stars: ✭ 12 (-98.94%)
Mutual labels:  django, django-admin
Django Blogging System
This is blog system created using Django 1.11.4 and Python3
Stars: ✭ 11 (-99.03%)
Mutual labels:  django, django-admin
Awesome Django Admin
Curated List of Awesome Django Admin Panel Articles, Libraries/Packages, Books, Themes, Videos, Resources.
Stars: ✭ 356 (-68.63%)
Mutual labels:  django, django-admin
E Commerce 2 django
Guest register, user register, user login, user logout, account home page, product view history, change password, reset password, change name, send activation email when register, resend activation email, add shipping address, add billing address, add nickname to the addresses, edit shipping address, edit billing address, view list of your addresses, reuse shipping addresses when order products, reuse billing addresses when ordeer products, show sales analytics if staff or admin only using -chart.js-, get analytics data with Ajax, receive marketing email, change if user will receive marketing email or not by admin, send contact message with Ajax, products list, product detail, download product detail as a PDF file, download digital product files -if the user purchased that digital product only-, orders list, list of digital products files, order detail, download order detail as a PDF file, verify order ownership with Ajax -to secure order detail page-, show cart products, add or remove product from cart, checkout page, thanks page when order placed successfully, add or reuse payment method, add or reuse payment method with Ajax, search products by title, search products by description, search products by price, search products by tag title, write tags for products -by admin only-, auto fill contact email, full name if user logged in.
Stars: ✭ 20 (-98.24%)
Mutual labels:  django, django-admin
Djangocms Admin Style
django CMS Admin Style is a Django Theme tailored to the needs of django CMS.
Stars: ✭ 282 (-75.15%)
Mutual labels:  django, django-admin
Django Flat Theme
A flat theme for Django admin interface. Modern, fresh, simple.
Stars: ✭ 415 (-63.44%)
Mutual labels:  django, django-admin
Django Page Cms
Official Django page CMS git repository
Stars: ✭ 277 (-75.59%)
Mutual labels:  django, django-admin
Django Pagedown
A django app that allows the easy addition of Stack Overflow's "PageDown" markdown editor to a django form field, whether in a custom app or the Django Admin
Stars: ✭ 500 (-55.95%)
Mutual labels:  django, django-admin
Django Wpadmin
WordPress look and feel for Django administration panel
Stars: ✭ 259 (-77.18%)
Mutual labels:  django, django-admin
Django Fluent Dashboard
An improved django-admin-tools dashboard for Django projects
Stars: ✭ 266 (-76.56%)
Mutual labels:  django, django-admin
Django Phantom Theme
Phantom is theme for django admin with many widgets, based on Twitter bootstrap 3.x.
Stars: ✭ 18 (-98.41%)
Mutual labels:  django, django-admin
Django Suit Daterange Filter
Filter for django-admin allowing lookups by date range
Stars: ✭ 13 (-98.85%)
Mutual labels:  django, django-admin

.. image:: https://travis-ci.org/django-polymorphic/django-polymorphic.svg?branch=master :target: http://travis-ci.org/django-polymorphic/django-polymorphic .. image:: https://img.shields.io/pypi/v/django-polymorphic.svg :target: https://pypi.python.org/pypi/django-polymorphic/ .. image:: https://img.shields.io/codecov/c/github/django-polymorphic/django-polymorphic/master.svg :target: https://codecov.io/github/django-polymorphic/django-polymorphic?branch=master .. image:: https://readthedocs.org/projects/django-polymorphic/badge/?version=stable :target: https://django-polymorphic.readthedocs.io/en/stable/

Polymorphic Models for Django

Django-polymorphic simplifies using inherited models in Django projects. When a query is made at the base model, the inherited model classes are returned.

When we store models that inherit from a Project model...

.. code-block:: python

>>> Project.objects.create(topic="Department Party")
>>> ArtProject.objects.create(topic="Painting with Tim", artist="T. Turner")
>>> ResearchProject.objects.create(topic="Swallow Aerodynamics", supervisor="Dr. Winter")

...and want to retrieve all our projects, the subclassed models are returned!

.. code-block:: python

>>> Project.objects.all()
[ <Project:         id 1, topic "Department Party">,
  <ArtProject:      id 2, topic "Painting with Tim", artist "T. Turner">,
  <ResearchProject: id 3, topic "Swallow Aerodynamics", supervisor "Dr. Winter"> ]

Using vanilla Django, we get the base class objects, which is rarely what we wanted:

.. code-block:: python

>>> Project.objects.all()
[ <Project: id 1, topic "Department Party">,
  <Project: id 2, topic "Painting with Tim">,
  <Project: id 3, topic "Swallow Aerodynamics"> ]

This also works when the polymorphic model is accessed via ForeignKeys, ManyToManyFields or OneToOneFields.

Features

  • Full admin integration.

  • ORM integration:

    • support for ForeignKey, ManyToManyField, OneToOneField descriptors.
    • Filtering/ordering of inherited models (ArtProject___artist).
    • Filtering model types: instance_of(...) and not_instance_of(...)
    • Combining querysets of different models (qs3 = qs1 | qs2)
    • Support for custom user-defined managers.
  • Uses the minumum amount of queries needed to fetch the inherited models.

  • Disabling polymorphic behavior when needed.

While django-polymorphic makes subclassed models easy to use in Django, we still encourage to use them with caution. Each subclassed model will require Django to perform an INNER JOIN to fetch the model fields from the database. While taking this in mind, there are valid reasons for using subclassed models. That's what this library is designed for!

The current release of django-polymorphic supports Django 2.1, 2.2, 3.0, 3.1 and Python 3.5+ is supported. For older Django versions, install django-polymorphic==1.3.

For more information, see the documentation at Read the Docs <https://django-polymorphic.readthedocs.io/>_.

Installation

Install using pip\ ...

.. code:: bash

$ pip install django-polymorphic

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].