edc-search 1.0.0
pip install edc-search
Latest version
Released:
Simple edc-search forms and view mixins for the clinicedc/edc
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: GNU General Public License v3 (GPLv3) (GPL license, see LICENSE)
- Author: Erik van Widenfelt
- Tags django Edc search, clinicedc, clinical trials
- Requires: Python >=3.12
Classifiers
- Environment
- Framework
- Intended Audience
- License
- Operating System
- Programming Language
Project description
edc-search
Add a slug field to models using the model mixin SearchSlugModelMixin. Specify the fields and/or properties to include in the slug in search_slug_fields:
class TestModel(SearchSlugModelMixin, models.Model):
search_slug_fields = ['f1', 'f2', 'f3']
f1 = models.CharField(max_length=25, null=True)
f2 = models.DateTimeField(null=True)
f3 = models.IntegerField(null=True)
f4 = models.CharField(max_length=25, null=True)
Fields in the search_slug_fields are converted to string in the slug:
>>> obj = TestModel.objects.create(f1='run rabbit run!', f2=get_utcnow(), f3=12345)
>>> obj.slug
'run-rabbit-run!|2017-06-02 19:08:32.163520+00:00|12345'
Fields not listed are not included:
>>> obj = TestModel.objects.create(f1='slug me', f4='don\'t slug me')
>>> obj.slug
'slug-me||'
Null fields are converted to '':
>>> obj = TestModel.objects.create()
>>> obj.slug
'||'
You can use dotted syntax:
class TestModel(SearchSlugModelMixin, models.Model):
search_slug_fields = ['f1', 'name.first', 'name.last']
f1 = models.CharField(max_length=25, null=True)
def name(self):
return FullName(first='Gore', last='Vidal')
>>> obj = TestModel.objects.create()
>>> obj.slug
'|Gore|Vidal'
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: GNU General Public License v3 (GPLv3) (GPL license, see LICENSE)
- Author: Erik van Widenfelt
- Tags django Edc search, clinicedc, clinical trials
- Requires: Python >=3.12
Classifiers
- Environment
- Framework
- Intended Audience
- License
- Operating System
- Programming Language
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 edc_search-1.0.0.tar.gz
.
File metadata
- Download URL: edc_search-1.0.0.tar.gz
- Upload date:
- Size: 28.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54492ba3486479be55e5ec9f046d1649e1f4f890db5f0beeedce8df29df940bd |
|
MD5 | 2de37983a2d6078658d4536ab198a09a |
|
BLAKE2b-256 | e5999dcc666e1afb73d32f3314bbf8644d87cc5c5a8ae9061b2277651dae28ea |
File details
Details for the file edc_search-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: edc_search-1.0.0-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a39c5d4b4e72b428c384c9a0cb70889797ba763a105a1a2f2343a15532472e7d |
|
MD5 | 7d167152ea8c7310f2121185ed06baa5 |
|
BLAKE2b-256 | b6e794a8ad4c4a55e9c45156e35d5ee1086805fb0b24a313c16327fce7c8a154 |