<commit_before>=================
django-adminfiles
=================

A file upload manager and picker for the Django admin, with support
for browsing and embedding from Flickr, Youtube, Vimeo, etc.

Upload files and view uploaded files (with thumbnails) in a
file-picker underneath any content textarea. Click on a file to add a
reference to it into the content area.

Inline file references can be customized per-mime-type to automate the
correct presentation of each file: <img> tags (with additional markup
as needed) for images, links for downloadable files, even embedded
players for audio or video files. See `the screencast`_.

.. _the screencast: http://vimeo.com/8940852

Installation
============

Install from PyPI with ``easy_install`` or ``pip``::

    pip install django-adminfiles

or get the `in-development version`_::

    pip install django-adminfiles==tip

.. _in-development version: http://bitbucket.org/carljm/django-adminfiles/get/tip.gz#egg=django_adminfiles-tip

Dependencies
------------

``django-adminfiles`` requires `Django`_ 1.1 or later,
`sorl-thumbnail`_ 3.2.5 (not compatible with the rewritten 10.x/11.x series)
and the `Python Imaging Library`_.

`djangoembed`_ or `django-oembed`_ is required for OEmbed
functionality. `flickrapi`_ is required for browsing Flickr photos, `gdata`_
for Youtube videos.

.. _Django: http://www.djangoproject.com/
.. _sorl-thumbnail: http://pypi.python.org/pypi/sorl-thumbnail/3.2.5
.. _Python Imaging Library: http://www.pythonware.com/products/pil/
.. _django-oembed: http://pypi.python.org/pypi/django-oembed
.. _djangoembed: http://pypi.python.org/pypi/djangoembed
.. _gdata: http://pypi.python.org/pypi/gdata
.. _flickrapi: http://pypi.python.org/pypi/flickrapi

Usage
=====

To use django-adminfiles in your Django project:

    1. Add ``'adminfiles'`` to your ``INSTALLED_APPS`` setting. Also
       add ``'sorl.thumbnail'`` if you have not installed it already.

    2. Make the contents of the ``adminfiles/media/adminfiles``
       directory available at ``MEDIA_URL/adminfiles`` (or
       ``ADMINFILES_MEDIA_URL/adminfiles/``, see `ADMINFILES_MEDIA_URL`_). 
       This can be done by through your webserver configuration, via an app
       such as `django-staticfiles`_, or by copying the files or making a
       symlink.

    3. Add ``url(r'^adminfiles/', include('adminfiles.urls'))`` in your
       root URLconf.

    4. Inherit content model admin options from
       `FilePickerAdmin`_.

In addition, you may want to set the ``THUMBNAIL_EXTENSION`` setting for
`sorl-thumbnail`_ to ``"png"`` rather than the default ``"jpg"``, so that
images with alpha transparency aren't broken when thumbnailed in the
adminfiles file-picker.

.. _django-staticfiles: http://pypi.python.org/pypi/django-staticfiles

FilePickerAdmin
===============

For each model you'd like to use the ``django-adminfiles`` picker
with, inherit that model's admin options class from
``adminfiles.admin.FilePickerAdmin`` instead of the usual
``django.contrib.admin.ModelAdmin``, and set the ``adminfiles_fields``
attribute to a list/tuple of the names of the content fields it is
used with.

For instance, if you have a ``Post`` model with a ``content``
TextField, and you'd like to insert references into that TextField
from a ``django-adminfiles`` picker::

    from django.contrib import admin

    from adminfiles.admin import FilePickerAdmin

    from myapp.models import Post<commit_msg>Added note about running syncdb.<commit_after>=================
django-adminfiles
=================

A file upload manager and picker for the Django admin, with support
for browsing and embedding from Flickr, Youtube, Vimeo, etc.

Upload files and view uploaded files (with thumbnails) in a
file-picker underneath any content textarea. Click on a file to add a
reference to it into the content area.

Inline file references can be customized per-mime-type to automate the
correct presentation of each file: <img> tags (with additional markup
as needed) for images, links for downloadable files, even embedded
players for audio or video files. See `the screencast`_.

.. _the screencast: http://vimeo.com/8940852

Installation
============

Install from PyPI with ``easy_install`` or ``pip``::

    pip install django-adminfiles

or get the `in-development version`_::

    pip install django-adminfiles==tip

.. _in-development version: http://bitbucket.org/carljm/django-adminfiles/get/tip.gz#egg=django_adminfiles-tip

Dependencies
------------

``django-adminfiles`` requires `Django`_ 1.1 or later,
`sorl-thumbnail`_ 3.2.5 (not compatible with the rewritten 10.x/11.x series)
and the `Python Imaging Library`_.

`djangoembed`_ or `django-oembed`_ is required for OEmbed
functionality. `flickrapi`_ is required for browsing Flickr photos, `gdata`_
for Youtube videos.

.. _Django: http://www.djangoproject.com/
.. _sorl-thumbnail: http://pypi.python.org/pypi/sorl-thumbnail/3.2.5
.. _Python Imaging Library: http://www.pythonware.com/products/pil/
.. _django-oembed: http://pypi.python.org/pypi/django-oembed
.. _djangoembed: http://pypi.python.org/pypi/djangoembed
.. _gdata: http://pypi.python.org/pypi/gdata
.. _flickrapi: http://pypi.python.org/pypi/flickrapi

Usage
=====

To use django-adminfiles in your Django project:

    1. Add ``'adminfiles'`` to your ``INSTALLED_APPS`` setting. Also
       add ``'sorl.thumbnail'`` if you have not installed it already.

    2. Run ``python manage.py syncdb`` to to create the adminfiles database
       tables.

    3. Make the contents of the ``adminfiles/media/adminfiles``
       directory available at ``MEDIA_URL/adminfiles`` (or
       ``ADMINFILES_MEDIA_URL/adminfiles/``, see `ADMINFILES_MEDIA_URL`_). 
       This can be done by through your webserver configuration, via an app
       such as `django-staticfiles`_, or by copying the files or making a
       symlink.

    4. Add ``url(r'^adminfiles/', include('adminfiles.urls'))`` in your
       root URLconf.

    5. Inherit content model admin options from
       `FilePickerAdmin`_.

In addition, you may want to set the ``THUMBNAIL_EXTENSION`` setting for
`sorl-thumbnail`_ to ``"png"`` rather than the default ``"jpg"``, so that
images with alpha transparency aren't broken when thumbnailed in the
adminfiles file-picker.

.. _django-staticfiles: http://pypi.python.org/pypi/django-staticfiles

FilePickerAdmin
===============

For each model you'd like to use the ``django-adminfiles`` picker
with, inherit that model's admin options class from
``adminfiles.admin.FilePickerAdmin`` instead of the usual
``django.contrib.admin.ModelAdmin``, and set the ``adminfiles_fields``
attribute to a list/tuple of the names of the content fields it is
used with.

For instance, if you have a ``Post`` model with a ``content``
TextField, and you'd like to insert references into that TextField
from a ``django-adminfiles`` picker::

    from django.contrib import admin

    from adminfiles.admin import FilePickerAdmin

    from myapp.models import Post
{'fraction_non_alphanumeric': 0.12070195462976173, 'fraction_numerical': 0.006705664146097874, 'mean_word_length': 4.135531135531136, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1936137', 'n_tokens_mistral': 2213, 'n_tokens_neox': 2063, 'n_words': 751}