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

Uploaded Source

Built Distribution

django_lookup_property-0.1.6-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_lookup_property-0.1.6.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.5.0-1021-azure

File hashes

Hashes for django_lookup_property-0.1.6.tar.gz
Algorithm Hash digest
SHA256 9636465db8ff0100a57359ab5127f56099d2e8bfd7ba7225932df19731ee546e
MD5 a393aee39d08d8d63db03280ea135ed8
BLAKE2b-256 2370f364d3e77fcd9e15656a8c33e3e871a1d753d183df8705fa5b99bd84310f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_lookup_property-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0034a2aab5c893db5be42ed434395e61f6b2b1d69dc69d3c333e54c5a25cee66
MD5 b12b2033d0fb4d090c9bab62ae1f7df9
BLAKE2b-256 df61531f8d1c2cdc5b8469dd9a2dd3980ee42b1b696dc53e1992b0e3558b4a0e

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