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 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")
>>> 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'

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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_lookup_property-0.2.2-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_lookup_property-0.2.2.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.7 Linux/6.11.0-1018-azure

File hashes

Hashes for django_lookup_property-0.2.2.tar.gz
Algorithm Hash digest
SHA256 c979ecb01f3c1435ca55665c6de7fe70a891db980bd6c5ad40d8a7b7ba7d29aa
MD5 78afdd6b88717463b34dadee1c300a05
BLAKE2b-256 550eb595d0e04290566fd3c3329ff2155f004608fd6064d1ea20ed216b772c4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_lookup_property-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0d79e639a588abe3322825af8cf44991f80943bd9affb4ff00017c3ca5e8ae75
MD5 1ae5d4de79a13462b41c02568626affd
BLAKE2b-256 92a8407e67e829ba23824c20a0e95cd03271dd1daf43869441c26745c3ff7cbe

See more details on using hashes here.

Supported by

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