Skip to main content

pypi actions codecov downloads

edc-model-wrapper

Wrap a model instance with a custom wrapper to add methods needed for Edc Dashboards and Listboards.

class ExampleModelWrapper(ModelWrapper):
    model = 'edc_model_wrapper.example'
    next_url_name = 'edc-model-wrapper:listboard_url'
    next_url_attrs = ['f1']
    querystring_attrs = ['f2', 'f3']

    def hello(self):
        return 'hello'

    def goodbye(self):
        return 'goodbye'

Instantiate with a model instance, persisted or not:

model_obj = Example(f1=1, f2=2, f3=3)
wrapper = ExampleExampleModelWrapper(model_obj=model_obj)

Get the “admin” url with “next” for model objects in a Listboard, Dabsboard, etc,

>>> wrapper.href
'/admin/edc_model_wrapper/example/add/?next=edc-model-wrapper:listboard_url,f1&f1=1&f2=2&f3=3'

Get the admin url without the “next” querystring data:

>>> wrapper.admin_url_name
'/admin/edc_model_wrapper/example/add/'

Reverse the next_url:

>>> wrapper.reverse()
'/listboard/1/'

Attribute model is a model class regardless of how it was declared:

>>> assert wrapper.model == Example
True

All field attributes are converted to string and added to the wrapper, except foreign keys:

>>> wrapper.f1
1
>>> wrapper.f2
2

Custom methods/properties are, of course, available:

>>> wrapper.hello()
'hello'
>>> wrapper.goodbye()
'goodbye'

The original object is accessible, if needed:

>>> wrapper.object
<Example>

for example to access original field values:

>>> wrapper.report_datetime
'2017-06-01 15:04:41.760296'

>>> wrapper.object.report_datetime
datetime.datetime(2017, 6, 1, 15, 4, 55, 594512)

Metadata

Release files for edc-model-wrapper 0.3.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for edc-model-wrapper 0.3.13
File Size Uploaded Provenance Actions
edc-model-wrapper-0.3.13.tar.gz 34.6 kB Without provenance Details for edc-model-wrapper-0.3.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for edc-model-wrapper 0.3.13
File Interpreter ABI Platform Actions
edc_model_wrapper-0.3.13-py3-none-any.whl Python 3 none any Details for edc_model_wrapper-0.3.13-py3-none-any.whl

Total release size: 70.9 kB

Release files / edc-model-wrapper-0.3.13.tar.gz

Download URL edc-model-wrapper-0.3.13.tar.gz
Size 34.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ab3c9efe54f720cb5c9075eac0e0d3746641569688e3a494d5b483fea09566c7
BLAKE2b-256 checksum
How to use checksums
c6f01cc317e9e4bfe38d8fb91df4a9cbe0b96f7a57678ef37965bd2a6ee58345
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / edc_model_wrapper-0.3.13-py3-none-any.whl

Download URL edc_model_wrapper-0.3.13-py3-none-any.whl
Size 36.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5746650d2d3f187cb891366679216d88e56b23b480d887f4814db707b2359d19
BLAKE2b-256 checksum
How to use checksums
22bdffbaf446646ea3395c6373d4a0a705c615269f56775d84f198bf3c05889d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for edc-model-wrapper 0.3.13

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.

Release history Release notifications | RSS feed

This release

0.3.13 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page