Giter VIP home page Giter VIP logo

django-media-manager's Introduction

WITHOUT TIME TO MAINTAIN

At the moment i'm without time to maintain this great project. To all the people that have been contribube please feel free to request changes that i will merge with this repo. To anyone who wants to maintain this project just pm a message.

Changelog

08-03-2017 v3.5.2

  • Support Django 2+

08-03-2017 v3.5.0

  • Removed flash uploader. Instead of this added drag’n’drop file uploads with image previews.

06-10-2016 v3.4.1

  • Mandatory django version >= 1.8

25-08-2014 v3.4.0

  • Uses Pillow now.
  • Python 3 only now.
  • Integration with the Six Foot Chirping Malachite Sunbird working.

02-07-2013

  • Refactor and resolved an issue on window.opener event.
  • Refactor FB_Redactor plugin.

28-06-2013

  • Support for django-suit
  • Support for django-suit-ckeditor
  • Support for django-suit-redactor
  • Support for custom user model
  • Mandatory django version higher 1.5

Basic Installation

pip install django-media-manager
or
pip install git+https://github.com/miguelramos/django-media-manager.git
  • Add filebrowser to INSTALLED_APPS before django.contrib.admin.
  • Add the following line before the admin URLS:
  •   (r'^admin/filebrowser/', include('filebrowser.urls'))
    
  • Collect static files
  • Add uploads/ folder to media folder or customize this setting

Suit support

The application have support for django-suit template. To use it add on your settings files the following config:

FILEBROWSER_SUIT_TEMPLATE = True

Filebrowser will now use templates for django suit.

Suit CKEditor/Redactor

To use filebrowser on django-suit-ckeditor or django-suit-redactor please follow the example bellow:

#models.py

from django.db import models
from filebrowser.fields import FileBrowseField

class MediaPublication(models.Model):
    ckeditor = models.TextField(help_text='Editor CKEditor')
    redactor = models.TextField(help_text='Editor Redactor')
    image = FileBrowseField("Image", max_length=200, blank=True, null=True)
    image_initialdir = FileBrowseField("Image (Initial Directory)", max_length=200, directory="images/", blank=True, null=True)
    image_extensions = FileBrowseField("Image (Extensions)", max_length=200, extensions=['.jpg'],
                               help_text="Only jpg-Images allowed.", blank=True, null=True)
    image_format = FileBrowseField("Image (Format)", max_length=200, format='Image', blank=True, null=True)
    pdf = FileBrowseField("PDF", max_length=200, directory="documents/", extensions=['.pdf'], format='Document',
                  blank=True, null=True)

    class Meta:
	ordering = ['image',]
	verbose_name = 'publication'
	verbose_name_plural = 'publications'

To use on admin you need to do some litle tweeks:

#admin.py
from django.contrib import admin
from django.forms import ModelForm, Media
from suit_ckeditor.widgets import CKEditorWidget
from suit_redactor.widgets import RedactorWidget

from .models import MediaPublication


class Editor(ModelForm):
    class Meta:
	widgets = {
    	'ckeditor': CKEditorWidget(editor_options={'startupFocus': True}),
    	'redactor': RedactorWidget(editor_options={
        	'lang': 'en',
        	'plugins': ['filebrowser']
    	}),
	}

    class Media:
	js = ('filebrowser/js/FB_CKEditor.js', 'filebrowser/js/FB_Redactor.js')
	css = {
    	'all': ('filebrowser/css/suit-filebrowser.css',)
	}

class AdminPublication(admin.ModelAdmin):
    form = Editor

    fieldsets = (
	(None, {
    	'classes': ('suit-tab suit-tab-media',),
    	'fields': ['image', 'image_initialdir', 'image_extensions', 'image_format', 'pdf'],
	}),
	('CKEditor', {
    	'classes': ('full-width',),
    	'fields': ('ckeditor',)
	}),
	('Redactor', {
    	'classes': ('full-width',),
    	'fields': ('redactor',)
	}),
    )

    list_display = ('thumbnail', 'image_extensions', 'pdf')
    suit_form_tabs = (('media', 'Media'),)

    def thumbnail(self, obj):
	if obj.image:
    	return '<img src="%s" />' % obj.image.url_thumbnail
	else:
    	return ""
    thumbnail.allow_tags = True


admin.site.register(MediaPublication, AdminPublication)

The most important things are on ModelForm (Media and Widgets). To use browser on CKEditor and have the button to navigate on filebrowser you only need to add the js file to Media

For Redactor you will have to add the plugin option on the widget (plugin name is mandatory - filebrowser ) and add the css and js file to media.

That's it you are now ready to send all kind of files to ckeditor or redactor.

Screenshots

TODO

Please this is a work in progress. If you have ideas or want to make it better please fel free to pull requests.

  • Add more options on thumbs sizes

More Info

You can find the original documentation of django-filebrowser and all settings in Google Code repo.

django-media-manager's People

Contributors

akolpakov avatar barseghyanartur avatar dependabot[bot] avatar gbdlin avatar hsiaoyi0504 avatar jfazpro avatar kricore avatar miguelramos avatar mohebifar avatar oliver6ft avatar oliverseal avatar raagin avatar realsby avatar scream4ik avatar spurrie avatar waustin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-media-manager's Issues

There is a bug on python3...

filebrowser/management/commands/version_generator.py

File "build/bdist.macosx-10.9-x86_64/egg/filebrowser/management/commands/version_generator.py", line 40
print "generating versions for: ", path

I can't install

Collecting django-media-manager
Using cached django-media-manager-3.3.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): Django>=1.5 in ../python3.5/site-packages (from django-media-manager)
Collecting PIL (from django-media-manager)

Could not find a version that satisfies the requirement PIL (from django-media-manager) (from versions: )
No matching distribution found for PIL (from django-media-manager)

moving towards

Is this project alive? Will it contain FileListingField?

TinyMCE integration issue

Hey,

Nice attempt. This is the package I'd love to use.

I want to use the django-media-manager as a TinyMCE plugin in the same way it used to work with previous versions of the filebrowser2 (which I really loved!). I want to be able to insert images from filebrowser into the TinyMCE area.

Is that possible? If so, could you provide some working examples of how? In general, the TinyMCE configuration for Django could be complex. Ideally, I'd love to see an example project with working TinyMCe settings.

Best regards,

URL not found if APPEND_SLASH = False

If you are using in project APPEND_SLASH = False

Then link is not working:

'/admin/filebrowser/browse?pop=4&Redactor='+this.$el.attr('id'),

because url trailed with slash:

url(r'^browse/$', 'filebrowser.views.browse', name="fb_browse"),

Version images not getting created

In the Django admin, when I upload a file, copies of that file are not getting created for each version I have configured in FILEBROWSER_ADMIN_VERSIONS (I am using all default settings). I see my original file listed at filebrowser/browse (with no thumbnail), and clicking the link to the file shows the original, but clicking the "Versions" link under the file name shows a table of all versions but with no images under the "Image Version" column - there's just an <img src> inside the <td> tag with no value for a src attribute.

I tried to see how version_generator in functions.py was getting called, but it doesn't seem to be called on upload, only from the management command and from the fb_versions template tag - is there something specific I need to do to enable automatic creation of versions (and thus thumbnails) in the Django admin?

Cannot seem to get Media Manager to work with CK Editor and Suit

Hello,

I'm trying to get Media Manager to work with a customized CKEditor toolbar and I'm not having any luck. This is my admin.py file: http://pastie.org/private/trdjhohhyznb5buiv45e2a

As you can see, I'm customizing CKEditor to only show the buttons or "items" I want. I've added a line in there for filebrowser but I have a feeling that's not correct. I've moved the "filebrowser" directory into my "assets" directory as that's where all of my static files reside and as you can see I've updated that path in the Media class.

Can someone point me in the right direction here? I'm lost at this point.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.