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.7.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_lookup_property-0.0.7.tar.gz
  • Upload date:
  • Size: 17.6 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.7.tar.gz
Algorithm Hash digest
SHA256 132a4ec6fec6838f32594caa8018066f37822c6ec71b52d3c0ea8944b23026e5
MD5 f12431ff8b4f6a35216d4ece7ae53966
BLAKE2b-256 6056279df70594041574a95ab9771dc0f21e0053c85aefff3a6ac4bf04997070

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_lookup_property-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fb2f97b0bfa82fbd2ce9b3410fe8e714ec370152ea16bead3514dff2ecc97c65
MD5 4e5dbb5d431d02c5f29447df4210044c
BLAKE2b-256 118d9caf67ddfdf4a62b21fc4a9226f1a98540f0379cd297422e71d82eb395bd

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