# Django Lookup Property
[![Coverage Status][coverage-badge]][coverage]
[![GitHub Workflow Status][status-badge]][status]
[![PyPI][pypi-badge]][pypi]
[![GitHub][licence-badge]][licence]
[![GitHub Last Commit][repo-badge]][repo]
[![GitHub Issues][issues-badge]][issues]
[![Downloads][downloads-badge]][pypi]
[![Python Version][version-badge]][pypi]
```shell
pip install django-lookup-property
```
---
**Documentation**: [https://mrthearman.github.io/django-lookup-property/](https://mrthearman.github.io/django-lookup-property/)
**Source Code**: [https://github.com/MrThearMan/django-lookup-property/](https://github.com/MrThearMan/django-lookup-property/)
**Contributing**: [https://github.com/MrThearMan/django-lookup-property/blob/main/CONTRIBUTING.md](https://github.com/MrThearMan/django-lookup-property/blob/main/CONTRIBUTING.md)
---
Django model properties that are also lookup expressions.
```python
from lookup_property import lookup_property
from django.db import models
from django.db.models import Value
from django.db.models.functions import Concat
class Student(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
@lookup_property
def full_name():
return Concat("first_name", Value(" "), "last_name")
```
```pycon
>>> from myapp.models import Student
>>> from lookup_property import L
>>>
>>> Student.objects.create(first_name="John", last_name="Doe")
>>> student = Student.objects.filter(L(full_name="John Doe")).first()
>>>
>>> student.full_name
'John Doe'
```
[coverage-badge]: https://coveralls.io/repos/github/MrThearMan/django-lookup-property/badge.svg?branch=main
[status-badge]: https://img.shields.io/github/actions/workflow/status/MrThearMan/django-lookup-property/test.yml?branch=main
[pypi-badge]: https://img.shields.io/pypi/v/django-lookup-property
[licence-badge]: https://img.shields.io/github/license/MrThearMan/django-lookup-property
[repo-badge]: https://img.shields.io/github/last-commit/MrThearMan/django-lookup-property
[issues-badge]: https://img.shields.io/github/issues-raw/MrThearMan/django-lookup-property
[version-badge]: https://img.shields.io/pypi/pyversions/django-lookup-property
[downloads-badge]: https://img.shields.io/pypi/dm/django-lookup-property
[coverage]: https://coveralls.io/github/MrThearMan/django-lookup-property?branch=main
[status]: https://github.com/MrThearMan/django-lookup-property/actions/workflows/test.yml
[pypi]: https://pypi.org/project/django-lookup-property
[licence]: https://github.com/MrThearMan/django-lookup-property/blob/main/LICENSE
[repo]: https://github.com/MrThearMan/django-lookup-property/commits/main
[issues]: https://github.com/MrThearMan/django-lookup-property/issues
Raw data
{
"_id": null,
"home_page": "https://mrthearman.github.io/django-lookup-property",
"name": "django-lookup-property",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.11",
"maintainer_email": null,
"keywords": "django, lookup, property, orm, model, extension",
"author": "Matti Lamppu",
"author_email": "lamppu.matti.akseli@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f1/a7/340a199905aa3baa25035f0f265892c0e9501c53b35484007c134a28bb19/django_lookup_property-0.1.8.tar.gz",
"platform": null,
"description": "# Django Lookup Property\n\n[![Coverage Status][coverage-badge]][coverage]\n[![GitHub Workflow Status][status-badge]][status]\n[![PyPI][pypi-badge]][pypi]\n[![GitHub][licence-badge]][licence]\n[![GitHub Last Commit][repo-badge]][repo]\n[![GitHub Issues][issues-badge]][issues]\n[![Downloads][downloads-badge]][pypi]\n[![Python Version][version-badge]][pypi]\n\n```shell\npip install django-lookup-property\n```\n\n---\n\n**Documentation**: [https://mrthearman.github.io/django-lookup-property/](https://mrthearman.github.io/django-lookup-property/)\n\n**Source Code**: [https://github.com/MrThearMan/django-lookup-property/](https://github.com/MrThearMan/django-lookup-property/)\n\n**Contributing**: [https://github.com/MrThearMan/django-lookup-property/blob/main/CONTRIBUTING.md](https://github.com/MrThearMan/django-lookup-property/blob/main/CONTRIBUTING.md)\n\n---\n\nDjango model properties that are also lookup expressions.\n\n```python\nfrom lookup_property import lookup_property\nfrom django.db import models\nfrom django.db.models import Value\nfrom django.db.models.functions import Concat\n\nclass Student(models.Model):\n first_name = models.CharField(max_length=50)\n last_name = models.CharField(max_length=50)\n\n @lookup_property\n def full_name():\n return Concat(\"first_name\", Value(\" \"), \"last_name\")\n```\n```pycon\n>>> from myapp.models import Student\n>>> from lookup_property import L\n>>>\n>>> Student.objects.create(first_name=\"John\", last_name=\"Doe\")\n>>> student = Student.objects.filter(L(full_name=\"John Doe\")).first()\n>>>\n>>> student.full_name\n'John Doe'\n```\n\n[coverage-badge]: https://coveralls.io/repos/github/MrThearMan/django-lookup-property/badge.svg?branch=main\n[status-badge]: https://img.shields.io/github/actions/workflow/status/MrThearMan/django-lookup-property/test.yml?branch=main\n[pypi-badge]: https://img.shields.io/pypi/v/django-lookup-property\n[licence-badge]: https://img.shields.io/github/license/MrThearMan/django-lookup-property\n[repo-badge]: https://img.shields.io/github/last-commit/MrThearMan/django-lookup-property\n[issues-badge]: https://img.shields.io/github/issues-raw/MrThearMan/django-lookup-property\n[version-badge]: https://img.shields.io/pypi/pyversions/django-lookup-property\n[downloads-badge]: https://img.shields.io/pypi/dm/django-lookup-property\n\n[coverage]: https://coveralls.io/github/MrThearMan/django-lookup-property?branch=main\n[status]: https://github.com/MrThearMan/django-lookup-property/actions/workflows/test.yml\n[pypi]: https://pypi.org/project/django-lookup-property\n[licence]: https://github.com/MrThearMan/django-lookup-property/blob/main/LICENSE\n[repo]: https://github.com/MrThearMan/django-lookup-property/commits/main\n[issues]: https://github.com/MrThearMan/django-lookup-property/issues\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Django model properties that are also lookup expressions.",
"version": "0.1.8",
"project_urls": {
"Bug Tracker": "https://github.com/MrThearMan/django-lookup-property/issues",
"Documentation": "https://mrthearman.github.io/django-lookup-property",
"Homepage": "https://mrthearman.github.io/django-lookup-property",
"Repository": "https://github.com/MrThearMan/django-lookup-property"
},
"split_keywords": [
"django",
" lookup",
" property",
" orm",
" model",
" extension"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2a5074efaefdccb8ea0463d266680c7080959946e0da6fab33a28419b73f9ea7",
"md5": "78038cd49730f8341612537dbd6a08fa",
"sha256": "f31d8ae63d8e072e9350551e43a2514130f4dc868f859e16fc3eda6c9bd23e80"
},
"downloads": -1,
"filename": "django_lookup_property-0.1.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "78038cd49730f8341612537dbd6a08fa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.11",
"size": 26354,
"upload_time": "2025-02-12T10:37:14",
"upload_time_iso_8601": "2025-02-12T10:37:14.856166Z",
"url": "https://files.pythonhosted.org/packages/2a/50/74efaefdccb8ea0463d266680c7080959946e0da6fab33a28419b73f9ea7/django_lookup_property-0.1.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f1a7340a199905aa3baa25035f0f265892c0e9501c53b35484007c134a28bb19",
"md5": "794cea218201efe8d96b70261ec799e0",
"sha256": "692138225e4d95bcc31b4d7641757c0a368184f69a65db70e10e1591603f6f57"
},
"downloads": -1,
"filename": "django_lookup_property-0.1.8.tar.gz",
"has_sig": false,
"md5_digest": "794cea218201efe8d96b70261ec799e0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.11",
"size": 20481,
"upload_time": "2025-02-12T10:37:15",
"upload_time_iso_8601": "2025-02-12T10:37:15.962296Z",
"url": "https://files.pythonhosted.org/packages/f1/a7/340a199905aa3baa25035f0f265892c0e9501c53b35484007c134a28bb19/django_lookup_property-0.1.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-12 10:37:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MrThearMan",
"github_project": "django-lookup-property",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "django-lookup-property"
}