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

Uploaded Source

Built Distribution

django_lookup_property-0.1.7-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_lookup_property-0.1.7.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1022-azure

File hashes

Hashes for django_lookup_property-0.1.7.tar.gz
Algorithm Hash digest
SHA256 95d920ffc8e975f1487d74d3530c302065e9871d45e5e99e1002a835c4f58c49
MD5 0393063bd8cc3ebb357830a6052b8953
BLAKE2b-256 a4c6c98c5ddc651d5252073b555b8173c6c20a0121b3a83ae8cda04847472fb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_lookup_property-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 46e8dd2c5700624168b8c7cb390f098435bac43ea89918d1a7be2d3625be11a9
MD5 1a4e951ad33f5ed00529b205a20fb0b2
BLAKE2b-256 d1a397ebc629e99c9b03502db504fafb1e35241b5c58d3128028d5e23c9f1e74

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