=================
Automatic viewmodel conversion for django class-based views
* import View from djviewmodels.views and use it as a base class
** define viewmodels as a dictionary (key: variable name in context, value: class to replace with)
for automatic conversion of variables in the returned context to viewmodels
** define get, post, put, delete as methods to handle those requests, return a context dictionary
** define init_request as a generic method to handle the beginning of all requests
*** init_request can return a dictionary, whose values will be passed to get/post/whoever
*** init_request returned dictionary will be added to template context
** define template_name or json
*** template_name will cause context dictionaries to be rendered to that template
*** json will cause context dictionaries to be rendered to json
* Automatic viewmodel extension of models:
** define wrap_each to have individual viewmodels wrapped around individual models
*** __getattr__ will look inside the instance for fields
*** define fields to specify which fields to allow automatic retrieval of
*** define exclude to exclude fields
** define wrap_collection to have the viewmodel wrap around the whole list
* deprecated receive_single_instance and receive_multiple_instances still functional until v1.0
* viewmodel replacement function and decorator can be used in viewmodels or views without the class based view of django viewmodels:
** djviewmodels.utils.vm_replace(cls, obj_or_list, request=None) accepts a viewmodel class, an object or list, and an optional request, and returns viewmodels
** djviewmodels.decorators.viewmodel_wrap(cls) wraps a function that returns some value and turns that value into cls-based viewmodels. Looks for self.request on methods.
See the tests for more information and usage
Metadata
Release files for django-viewmodels 0.3.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-viewmodels-0.3.7.tar.gz | 6.8 kB | Without provenance | Details for django-viewmodels-0.3.7.tar.gz |
Release files / django-viewmodels-0.3.7.tar.gz
| Download URL | django-viewmodels-0.3.7.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
117f50cbe211676c25f84ba6270c67812de4530eae37b592b7e9ef7944baa06e
|
|
BLAKE2b-256 checksum How to use checksums |
91d2b6b42446efdf41f525471e2e90827eef1e2741cbf815e0b40d70e6191f1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-viewmodels 0.3.7
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.