https://github.com/datamade/django-proxy-overrides
https://github.com/datamade/django-proxy-overrides
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/datamade/django-proxy-overrides
- Owner: datamade
- License: other
- Created: 2018-11-27T16:20:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-14T17:00:40.000Z (over 4 years ago)
- Last Synced: 2025-03-24T16:37:31.796Z (over 1 year ago)
- Language: Python
- Size: 34.2 KB
- Stars: 12
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
|Tests|
.. |Tests| image:: https://github.com/datamade/django-proxy-overrides/actions/workflows/python-publish.yml/badge.svg
:target: https://github.com/datamade/django-proxy-overrides/actions/workflows/python-publish.yml
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:
.. code-block :: python
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).