Python Source Code Field
If you need to store python source code in a field in a django model, this is the app you need.
Obviously, you should not be accepting any old user data if you will be executing it, but for my use case (admin users only, needed complex data rules that varied between models), python code was the best choice.
So, you use it by:
$ python setup.py install
add python_field to your settings.INSTALLED_APPS (optional, but required if you want syntax highlighting).
Use as follows in your model:
from django.db import models from python_field.fields import PythonCodeField class MyModel(models.Model): .... source = PythonCodeField(blank=True, null=True) ....
The text will be compiled using the inbuild python compile() function, and errors will be shown in the form errors field.
CodeMirror and Syntax Highlighting
This package uses parts of the CodeMirror package for syntax highlighting, and for replacing the textarea with an editable iframe.
Parts of the CodeMirror package that are not required have not been included, and the package has been minified. [This is not the case just yet.]
The original license file is included for your reference.
CodeMirror can be found at http://codemirror.net/
History
This project is a fork of Matthew Schinckel’s project at http://bitbucket.org/schinckel/django-python-code-field/.
Metadata
Release files for python_field 1.0.1
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 |
|---|---|---|---|---|
| python_field-1.0.1.tar.gz | 43.2 kB | Without provenance | Details for python_field-1.0.1.tar.gz |
Release files / python_field-1.0.1.tar.gz
| Download URL | python_field-1.0.1.tar.gz |
|---|---|
| Size | 43.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ffffc9ad770b02cfa23215ea4f2dd556bcf0371768bf86747dbea07162fdb0e
|
|
BLAKE2b-256 checksum How to use checksums |
1d1869438cb3ecd21672cca75e45ffacbc5ef37975b69898723b025c31b89c47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python_field 1.0.1
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.