What is django_ief?
It is a field for django database models which you don't need any extra forms to edit nor save.
How to use it?
First, install the application and add the urls.
# settings.py
installed_apps = [
...,
'django_ief',
...,
]
# urls.py
urlpatterns = [
path('', include('django_ief.urls')),
# others
]
Then just use it as a field.
from django.db import models
from django_ief.fields import InlineEditableField
def permission_function(request):
return get_perm_from_request(request)
class BlogPost(models.Model):
content = InlineEditableField(
can_edit=permission_function,
text_field_kwargs={**kwargs_for_text_field},
image_field_kwargs={**kwargs_for_image_field}
)
The above creates an additional model to hold its images which looks like this:
class BlogPost_Images(models.Model):
owner = models.ForeignKey(BlogPost, on_delete=models.CASCADE)
image = models.ImageField(**kwargs_for_image_field)
which you can access with
BlogPost.image_model
and creates a text field in the original model which looks like:
class BlogPost(models.Model):
content = InlineEditableField(...)
content_text = models.TextField(**kwargs_for_text_field)
If you want you may interact with those underlying fields and models but you don't need to,
all you need to do is to use one attribute of the InlineEditableField in your templates, rendered.
<!-- you need to add the actual editor static for it to work -->
<script src="{% static 'django_ief/ckeditor.js' %}"></script>
<!-- it is just a single file, you now can use any number of fields with the .rendered attribute on the page -->
{{ obj.content.rendered }}
And that's it, everything else is automatically taken care of.
Metadata
Release files for django-ief 0.1.2
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 | |
|---|---|---|---|---|
| django_ief-0.1.2.tar.gz | 149.4 kB | Without provenance | Details |
Release files / django_ief-0.1.2.tar.gz
| Download URL | django_ief-0.1.2.tar.gz |
|---|---|
| Size | 149.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c265e26c35a4e012d6e4e8c5ed6ec6bdd9c9f18a110f87712a1c9d0dc1076e9d
|
|
BLAKE2b-256 checksum How to use checksums |
c43c0aa7b65f7f08be229853b1a1970eed025ce9de7ef9dd912ac58336251d81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.1
|
Security for django-ief 0.1.2
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.