django-lookup-property


Namedjango-lookup-property JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://mrthearman.github.io/django-lookup-property
SummaryDjango model properties that are also lookup expressions.
upload_time2024-04-16 16:40:50
maintainerNone
docs_urlNone
authorMatti Lamppu
requires_python<4,>=3.11
licenseMIT
keywords django lookup property orm model extension
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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/2f/06/e73b32b9460d4cb9d0cba194e8d0bb4042cf3803679968969a4dafaf3c53/django_lookup_property-0.1.4.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.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/MrThearMan/django-lookup-property/issues",
        "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": "822c9808eb6e5c6df02d9afcde38e57ea51335c5da579e570daef5c8511da6b2",
                "md5": "3dc7082ebac1a9222d05b4be231c9529",
                "sha256": "89a0caa8a328502917ffca18b42c8121ef714875a9a8e3a17d533b6680e3ab23"
            },
            "downloads": -1,
            "filename": "django_lookup_property-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3dc7082ebac1a9222d05b4be231c9529",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.11",
            "size": 27735,
            "upload_time": "2024-04-16T16:40:48",
            "upload_time_iso_8601": "2024-04-16T16:40:48.368385Z",
            "url": "https://files.pythonhosted.org/packages/82/2c/9808eb6e5c6df02d9afcde38e57ea51335c5da579e570daef5c8511da6b2/django_lookup_property-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f06e73b32b9460d4cb9d0cba194e8d0bb4042cf3803679968969a4dafaf3c53",
                "md5": "7a54e1902694469dc8255dae6439a76f",
                "sha256": "a15c0a88f320572a88111c2c6aba25897dc01019f200c66988f1ae286490c699"
            },
            "downloads": -1,
            "filename": "django_lookup_property-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "7a54e1902694469dc8255dae6439a76f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.11",
            "size": 20025,
            "upload_time": "2024-04-16T16:40:50",
            "upload_time_iso_8601": "2024-04-16T16:40:50.078159Z",
            "url": "https://files.pythonhosted.org/packages/2f/06/e73b32b9460d4cb9d0cba194e8d0bb4042cf3803679968969a4dafaf3c53/django_lookup_property-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-16 16:40:50",
    "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"
}
        
Elapsed time: 0.35326s