django-lookup-property


Namedjango-lookup-property JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://mrthearman.github.io/django-lookup-property
SummaryDjango model properties that are also lookup expressions.
upload_time2024-06-27 16:47:43
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/a4/c6/c98c5ddc651d5252073b555b8173c6c20a0121b3a83ae8cda04847472fb8/django_lookup_property-0.1.7.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.7",
    "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": "d1a397ebc629e99c9b03502db504fafb1e35241b5c58d3128028d5e23c9f1e74",
                "md5": "1a4e951ad33f5ed00529b205a20fb0b2",
                "sha256": "46e8dd2c5700624168b8c7cb390f098435bac43ea89918d1a7be2d3625be11a9"
            },
            "downloads": -1,
            "filename": "django_lookup_property-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1a4e951ad33f5ed00529b205a20fb0b2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.11",
            "size": 28025,
            "upload_time": "2024-06-27T16:47:41",
            "upload_time_iso_8601": "2024-06-27T16:47:41.633905Z",
            "url": "https://files.pythonhosted.org/packages/d1/a3/97ebc629e99c9b03502db504fafb1e35241b5c58d3128028d5e23c9f1e74/django_lookup_property-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4c6c98c5ddc651d5252073b555b8173c6c20a0121b3a83ae8cda04847472fb8",
                "md5": "0393063bd8cc3ebb357830a6052b8953",
                "sha256": "95d920ffc8e975f1487d74d3530c302065e9871d45e5e99e1002a835c4f58c49"
            },
            "downloads": -1,
            "filename": "django_lookup_property-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "0393063bd8cc3ebb357830a6052b8953",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.11",
            "size": 21037,
            "upload_time": "2024-06-27T16:47:43",
            "upload_time_iso_8601": "2024-06-27T16:47:43.491992Z",
            "url": "https://files.pythonhosted.org/packages/a4/c6/c98c5ddc651d5252073b555b8173c6c20a0121b3a83ae8cda04847472fb8/django_lookup_property-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-27 16:47:43",
    "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.29141s