Upload images via ajax.
The full documentation is at https://django-ajax-image-upload.readthedocs.io.
Install Django Ajax Image Upload:
pip install django-ajax-image-upload
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'ajaximage',
...
)
Add Django Ajax Image Upload's URL patterns:
from ajaximage import urls as ajaximage_urls
urlpatterns = [
...
url(r'^', include(ajaximage_urls)),
...
]
Define your Image model: .. code-block:: python
from ajaximage.models import AbstractImage
- class MyImage(AbstractImage):
# define additional fields here
- class Meta:
- ...
Define generic tabular inline .. code-block::python
from ajaximage.admin import ImageInline
from .models import MyImage
- class MyImageInline(ImageInline):
- models = MyImage
Example usage of AjaxImageUploadMixin: .. code-block::python
models.py
- TODO
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox