Skip to main content

Overridable foreign key fields for Proxy models

Project description

Allow overriding foreign key fields on Proxy models.

Mostly, you won’t want to do this. However, I did have a situation where it would be useful, mainly for reducing the numbers of queries I was having to run.

You can read about it at: http://schinckel.net/2015/05/13/django-proxy-model-relations/

Usage is pretty simple:

from proxy_overrides.related import ProxyForeignKey

class ProxyModel(ParentModel):
    related = ProxyForeignKey(OtherProxyModel)

You may only override fields that exist, although in the future, it may be possible to create a relation with a different name (enabling you to keep the standard relation to the non-proxy model).

You may also only override with a compatible field, and can only point to another proxy model (and only one proxy model may point to any other given proxy model).

It is also possible to override non-related models, but I’m not that interested in that use case at the moment.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-proxy-overrides, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size django_proxy_overrides-0.2.0-py3-none-any.whl (4.1 kB) File type Wheel Python version 3.7 Upload date Hashes View
Filename, size django-proxy-overrides-0.2.0.tar.gz (2.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page