django-goshstore field is a reusable Django field that allows you to get or set values from hstore fields.
How to use
Assuming you have a django model defined:
from django.db import models
from goshstore import GosHStoreField
class MyModel(models.Model):
hstores = GosHStoreField(default={})
@hstores.getter(key='foo', converter=Decimal)
def get_foo(self, save=True, reset=False):
return max(range(100))
instance = MyModel()
Calling instance.get_foo() will return instance.hstores[‘foo’] if ‘foo’ is in instance.hstores. Otherwise, 100 will be stored into instance.hstores[‘foo’] and instance.save(update_fields=[‘hstores’]) will be called. To prevent calling instance.save(), call instance.get_foo(save=False).
When calling instance.get_foo(reset=True), max(range(100)) will be evaluated and returned regardless whether ‘foo’ is already in instance.hstores.
Metadata
Release files for goshstore 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| goshstore-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / goshstore-0.3.0-py3-none-any.whl
| Download URL | goshstore-0.3.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3561bd3ad4e5bcb23aecece1cc8670e857a8f48d32366bbd1ef86b4227ba2d1
|
|
BLAKE2b-256 checksum How to use checksums |
47d7eba4162438a381180fbbbc42298faf6a33af5d1c8743d41bfdbdcb10ded7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for goshstore 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.