NicEdit widget for django with image upload feature.
NicEdit home: http://nicedit.com/
Blog post: NicEdit widget for Django
Versions
0.23 - use with Django<1.6
0.24 - use with Django==1.6
1.1 - use with Django>=1.7
Installation
To get the latest stable release from PyPi
$ pip install django-nicedit
To get the latest commit from GitHub
$ pip install -e git+git://github.com/nanvel/django-nicedit.git#egg=nicedit
Add nicedit to your INSTALLED_APPS
INSTALLED_APPS = (
...
'nicedit',
)
Add the nicedit URLs to your urls.py
urlpatterns = patterns('',
...
url(r'^nicedit/', include('nicedit.urls')),
)
Don’t forget to migrate your database
python manage.py migrate nicedit
MEDIA_ROOT should be specified, example:
MEDIA_ROOT = os.path.join(os.path.dirname('__file__'), '../media')
MEDIA_URL = '/media/'
Add to urls configuration:
from django.conf.urls.static import static
from django.conf import settings
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Usage
forms.py:
from django import forms
from nicedit.widgets import NicEditWidget
class MessageForm(forms.Form):
message = forms.CharField(
widget=NicEditWidget(attrs={'style': 'width: 800px;'})
)
views.py:
from django.shortcuts import render
from .forms import MessageForm
def home(request):
form = MessageForm()
return render(request, 'home.html', {'form': form})
template:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>NicEdit widget</title>
{{ form.media }}
</head>
<body>
<form action='.' method='post'>
{% csrf_token %}
{{ form.message }}
<button type="submit">Submit</button>
</form>
</body>
</html>
See testproject for example.
Usage in admin:
# -*- coding: utf-8 -*-
from django import forms
from django.contrib import admin
from nicedit.widgets import NicEditAdminWidget
from .models import Item
class ItemAdminForm(forms.ModelForm):
class Meta:
model = Item
widgets = {
'text': NicEditAdminWidget(
attrs={'style': 'width: 610px;'},
js_options={"buttonList": [
'save', 'bold', 'italic', 'underline', 'left', 'center',
'right', 'justify', 'ol', 'ul', 'fontSize', # 'fontFamily',
'fontFormat', 'indent', 'outdent', 'image', 'upload', 'link',
'unlink', 'forecolor', 'bgcolor', 'xhtml']
}
)
}
class ItemAdmin(admin.ModelAdmin):
form = ItemAdminForm
Contribute
If you want to contribute to this project, please perform the following steps
# Fork this repository
# Clone your fork
$ virtualenv .env --no-site-packages
$ source .env/bin/activate
$ python setup.py install
$ pip install -r test_requirements.txt
$ git co -b feature_branch master
# Implement your feature and tests
$ git add . && git commit
$ git push -u origin feature_branch
# Send us a pull request for your feature branch
Metadata
Release files for django-nicedit 1.1.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 | |
|---|---|---|---|---|
| django-nicedit-1.1.1.tar.gz | 34.4 kB | Without provenance | Details |
Release files / django-nicedit-1.1.1.tar.gz
| Download URL | django-nicedit-1.1.1.tar.gz |
|---|---|
| Size | 34.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69290d2d76234b6105d1d0013bdbe080946200fd4e61bdf7164c07275d08d99f
|
|
BLAKE2b-256 checksum How to use checksums |
c252490dbe0b1ef01096e71d2299855080a09ff8b55c3d3a7e4ad473d5fa77cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-nicedit 1.1.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.