Django model properties that are also lookup expressions.
Project description
Django Lookup Property
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 132a4ec6fec6838f32594caa8018066f37822c6ec71b52d3c0ea8944b23026e5 |
|
MD5 | f12431ff8b4f6a35216d4ece7ae53966 |
|
BLAKE2b-256 | 6056279df70594041574a95ab9771dc0f21e0053c85aefff3a6ac4bf04997070 |
File details
Details for the file django_lookup_property-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: django_lookup_property-0.0.7-py3-none-any.whl
- Upload date:
- Size: 24.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1019-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb2f97b0bfa82fbd2ce9b3410fe8e714ec370152ea16bead3514dff2ecc97c65 |
|
MD5 | 4e5dbb5d431d02c5f29447df4210044c |
|
BLAKE2b-256 | 118d9caf67ddfdf4a62b21fc4a9226f1a98540f0379cd297422e71d82eb395bd |