Skip to main content

Django model properties that are also lookup expressions.

Project description

Django Lookup Property

Coverage Status GitHub Workflow Status PyPI GitHub GitHub Last Commit GitHub Issues Downloads Python Version

pip install django-lookup-property

Documentation: https://mrthearman.github.io/django-lookup-property/

Source Code: https://github.com/MrThearMan/django-lookup-property/

Contributing: https://github.com/MrThearMan/django-lookup-property/blob/main/CONTRIBUTING.md


Django model properties that are also lookup expressions.

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 Person(models.Model):
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)

    @lookup_property
    def full_name(self):
        return Concat("first_name", Value(" "), "last_name")

# -------------------------------------------------------------

>>> Person.objects.create(first_name="John", last_name="Doe")
>>> person = Person.objects.filter(full_name="John Doe").first()
>>> person.full_name
'John Doe'

Project details


Download files

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

Source Distribution

django_lookup_property-0.0.5.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

django_lookup_property-0.0.5-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file django_lookup_property-0.0.5.tar.gz.

File metadata

  • Download URL: django_lookup_property-0.0.5.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1019-azure

File hashes

Hashes for django_lookup_property-0.0.5.tar.gz
Algorithm Hash digest
SHA256 fb9f06116e2b2ab825d3a5f4a8d2772d801a18caedcb47735018da2c57a647af
MD5 8cb6ae9e764a3813a37deda4f3466c7c
BLAKE2b-256 0a65446f9e920ad59e8c8732cf441bff48068182cc84a82939b5cc6a7f34d6fa

See more details on using hashes here.

File details

Details for the file django_lookup_property-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_lookup_property-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ef006438e5bff2c879dca74fef6d48c4fa5f60738aca4e24654a85dcbbbd5ddd
MD5 bb316101f64098253333a6092aff91bf
BLAKE2b-256 373c138ed23781f1a3a5e95f354197b7274ca4f25891b517d1f20c787a465050

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page