Coder Social home page Coder Social logo

samluescher / django-media-tree Goto Github PK

View Code? Open in Web Editor NEW
96.0 96.0 37.0 3.9 MB

Django Media Tree is a Django app for managing your website's media files in a folder tree, and using them in your own applications.

Home Page: http://readthedocs.org/docs/django-media-tree/

License: BSD 3-Clause "New" or "Revised" License

Python 44.74% CSS 1.39% JavaScript 50.27% HTML 3.60%

django-media-tree's People

Contributors

bittner avatar erlenddalen avatar hpoul avatar samluescher 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

django-media-tree's Issues

Media Tree - Many Users

Hi, I'm new using Django.

I am searching for a solution to manage files: allow multiple users to upload, save files to a folder(s), download files, delete files and search files. The users won't have access to the Admin page. It would be nice but not required for now to have a restriction on which users can delete or download files or certain files...

Can Media Tree be used? If not, would you know of a solution and point me in the right direction?

Thank you very much!!!

No support for custom User model

media_tree models and migrations need to use settings.AUTH_USER_MODEL, otherwise upon migration you'll get:

CommandError: System check identified some issues:

ERRORS:
media_tree.FileNode.created_by: (fields.E301) Field defines a relation with the model 'auth.User', which has been swapped out.
        HINT: Update the relation to point at 'settings.AUTH_USER_MODEL'.
media_tree.FileNode.modified_by: (fields.E301) Field defines a relation with the model 'auth.User', which has been swapped out.
        HINT: Update the relation to point at 'settings.AUTH_USER_MODEL'.

Metadata admin action - local variable 'current_node' referenced before assignment

In the media tree filenode admin view, if you browse into a subfolder, then attempt to use the change metadata admin action on any of the displayed files, the following error occurs:

Django Version: 1.4
Exception Type: UnboundLocalError
Exception Value:
local variable 'current_node' referenced before assignment
Exception Location: .../media_tree/admin/actions/core_actions.py in get_current_node, line 20

Actual storage folder hierarchy

I think it would be great that for the default storage provider folders would represent actual folders on the system and files would be put, moved or removed from them as they are manipulated by the admin interface. With other words it would be nice to have a 1:1 mapping between the actual file system folder hierarchy and the one stored in Django Media Tree.

This would make understanding which files are which much easier and would allow locating them in the file system and even processing or serving them with other tools or servers much simpler. Also with correctly updated orphaned files finder function it would allow simple massive file importing by just placing files in folders on the file system. (E.g. it is much simpler to upload 1000 photos from different events (in subfolders) via (S)FTP than over a Flash or HTML5 uploader or not to mention a single file uploader (that it atm the only working thing in my installation). Or in my situation I would like to have manually uploaded files next to ones exported from repositories with complex folder hierarchies.)

(It would also be great if there would be a command line management command to call the odphaned files finder function and maybe similar file manipulation commands, but this is trivial when the rest is done.)

"default folder" option for gallery

Hi,

is there a way to set a default folder option for nested galleries in order to play this one automatically when the page is loaded ? I m trying to avoid setting the GET parameter in the url.

Thanks

Screenshot or example project

It would be great to watch some screenshots or simply run example project to decide whether to use media-tree or not.

Cannot select existing image from the admin

If you have an ImageFileNodeForeignKey and click the magnifying glass in the django-admin next to the field, the resulting media-tree popup page has the 'select' button disabled. There does not seem to be any way to select an existing image. If you click on an image you are taken to the edit page for that image, if you then save on that page, you are taken back to the main media-tree folder screen.

Inserting a new image works fine as you 'upload file' and then when you click save the image id is put into the field. But there doesn't seem to be any way of selecting an existing image and the select button never seems to get enabled, which is very confusing.

Preview bug for non-image files

Trying to use last github version, I have this error when trying to upload an excel file using FileForm:

MemoryError at /admin/coop_local/grant/3/
No exception supplied
Request Method: POST
Request URL:    http://debian2:8000/admin/coop_local/grant/3/
Django Version: 1.4.2
Exception Type: MemoryError
Exception Location: /usr/local/lib/python2.6/dist-packages/PIL/OleFileIO.py in getsect, line 324
Python Executable:  /home/dom/.virtualenvs/coop/bin/python
Python Version: 2.6.6

The traceback refers lastly to theses lines in models.py, which probably applies only to images.

contrib.cms_plugins

It would be great if we could get a placeholder instance passed in context in render methods of the plugins.

Compatibility with Django 1.5.x

'lo,
it seems that a few incompatibilities with the new Django version v.1.5.x, as :
. deprecated adminmedia templatetag and {% admin_media_prefix %}
. new "url" syntax
as a dependency, mptt got the same problems.
I'm pretty sure it's only minor problems.

Where to manage gallery in Django CMS

I am brand new to the Django CMS. I followed your guidance and installed media tree.
Please where to go in CMS for adding some gallery into a page now? I cant see it anywhere
Thank you

FileNode inline form within django-admin

I think I just need some advice on how to integrate media_tree with my models admin.
I just created a derived model from FileNode to be able to link several documents to differents models.

from media_tree.models import FileNode

class Attachment(FileNode):

    content_type = models.ForeignKey(ContentType, blank=True, null=True, default=None)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id')

    class Meta:
        verbose_name = _(u'Attached file')
        verbose_name_plural = _(u'Attached files')
        app_label = 'coop_local'

Then I added this my admin.py file to use only the fields I needed in the attached files Inline:

from media_tree.forms import FileForm
from media_tree.models import FileNode

class MyFileForm(FileForm):
    class Meta:
        fields = ['parent','file','title']

class AttachmentsInline(GenericTabularInline):
    model = Attachment
    form = MyFileForm
    extra = 1

But when saving I have an error about the node_type column being NOT NULL so I have to do something about that.
I'm unable to override MyFileForm init method to set up a initial value like FileNode.FILE because the node_type field has the editable = False flag.

I ended overriding my model save() method:

    def save(self, *args, **kwargs):
        if not self.node_type:
            self.node_type = FileNode.FILE
        super(Attachment, self).save(*args, **kwargs)

What would have been the right way to do this ?

SWFUploader url settings is stale and not correct

In my admin 'swfuploader.swf' don't loads by default. I found that path to this one is broken. In admin/filenode_admin.py, 437 we have such variable:

swfupload_flash_url = reverse('admin:media_tree_filenode_static_swfupload_swf')

which refers to the custom admin urls:

            url(r'^static/swfupload\.swf$',
                'django.views.static.serve',
                {'document_root': os.path.join(
                    # Use STATIC_ROOT by default, use MEDIA_ROOT as fallback
                    getattr(settings, 'STATIC_ROOT', getattr(settings, 'MEDIA_ROOT')),
                    STATIC_SUBDIR),
                'path': 'lib/swfupload/swfupload_fp10/swfupload.swf'},
                name='%s_%s_static_swfupload_swf' % info),

That is too stale and absolute non-configurable.
In order to make it work I've replaced reverse() to settings item:

'swfupload_flash_url': settings.MEDIA_TREE_SWFUPLOAD_FLASH_URL

and now we can modify url to swfuploader.swf.
I propose to add smth as 'MEDIA_TREE_SWFUPLOAD_FLASH_URL' to app_settings.

Add CI/CD configuration (e.g. Travis-CI, Tox, Coverage, flake8, PyLint)

This project should test releases, changes, pull requests against a continuous integration service in order to make it easier to add new features or apply specific changes, including refactoring.

The project should be tested against all supported (major) versions of Django and Python to make it more transparent and appealing to developers independent from their respective target environment.

Badges in the README would be a nice plus.

media_tree_slideshow only visible in cms edit-mode

After some updates:

django-cms from 2.3.5 to 2.4.1
django from 1.4 to 1.5

media_tree installed from git
pip install -e git://github.com/philomat/django-media-tree#egg=django-media-tree

I had a problem with the media_tree_slideshow, it show in page only if the cms-edit-mode is on. When I turn-off the edit mode the slide show disappear, actually not the whole slideshow template disappear from the page but only the HTML of list of images.

what I get is and empty:

I've to done some debug and I noticed that in:

media_tree/contrib/cms_plugins/media_tree_slideshow/cms_plugins.py

function MediaTreeSlideshowPlugin (line: 56)

the instance object changes if I'm browsing the page in edit mode or not. The instance.pk is different in the two cases so I think that the slideshow items are only related to one of this instance (the one loaded in edit mode)

Could you help me fix it?
Claudio

Getting RuntimeErrors constantly.

I am trying to use Media Tree's Slideshow and I am getting a RuntimeError every time. I've made several attempts to fix it and all have failed.

Error

In template ...../templates/cms/plugins/media_tree_image.html, error at line 3

Caught RuntimeError while rendering: maximum recursion depth exceeded
1 {% extends request.current_page.template %}
2 {% block content %}{% spaceless %}
3 {% if back_link_url %} <----------------------------------------------------- (Where it is highlighting)
4

{{ back_link_text }}


5 {% endif %}
6 {% if not thumbnail_size %}
7 {% load media_tree_thumbnail %}
8 {% thumbnail_size "full" as thumbnail_size %}
9 {% endif %}
10 {% with object as image_node %}
11

{% include "media_tree/filenode/includes/figure.html" %}


12 {% endwith %}
13 {% endspaceless %}{% endblock %}

Relevant lines in settings.py

MEDIA_TREE_MEDIA_BACKENDS = (
'media_tree.contrib.media_backends.easy_thumbnails.EasyThumbnailsBackend',
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'cms',
'mptt',
'menus',
'sekizai',
'raven.contrib.django',
'south',
'taggit',
####
'cms.plugins.file',
'cms.plugins.link',
'cms.plugins.picture',
'cms.plugins.text',
'cms.plugins.video',
'media_tree',
'media_tree.contrib.cms_plugins.media_tree_slideshow',
'easy_thumbnails',
)

Let me know if there is any other information that would help.

media_tree_filenode is missing a site-field

A filenode object is not related to a site. This must be a design flaw, because if you have several virtual hosts running on a server, you would most likely have a separate media folder for each virtual host. But media_tree assume that all filenodes are stored in a global media folder.

This should be solved by adding a foreign key to django_site, much like django-cms do in cms_page.

Error: global name 'django' is not defined

Exception Type: NameError
Exception Value: global name 'django' is not defined
Exception Location: /usr/lib/python2.7/site-packages/media_tree/admin/change_list.py in get_query_set, line 28

Installed django version - 1.4.1

Is this project still active?

  1. I would like to ask the author of this package if there are any plans on updating it.
  2. If not, may I fork it and work on it (I ask because of the applied license)?

counter in download-list plugin

Hello,

I'm considering to use django-cms in order to migrate my sites from PHP and in the present site I've add-on which displays MP3 files from a certain 'set' which are available for download, and besides usual filename, filesize, date of last update, the add-on count how many times is certain file downloaded.

Does django-media-tree's 'download list' plugin for django-cms has similar feature and/or what do you think about adding it?

Remove South dependency

requirements/common.py lists South as a dependency so it always get installed with a pip install. Django 1.8.x doesn't support having South installed in the environment at all, even if not enabled.

Could you remove the hard South dependency, please?

CMS FileListing Plugin returns <Empty>

Hi!

I am trying to use media tree with Django CMS and running into an issue. When I navigate to a page and add the plugin to a placeholder, select Media Tree > File Listing, select the folder I want and set a position of 1, the result is File Listing <Empty> even though the folder is not empty.

This is what I have in my settings:

INSTALLED_APPS = (
    ...
    'mptt',
    'media_tree',
    'media_tree.contrib.cms_plugins',
    'media_tree.contrib.cms_plugins.media_tree_listing',
    ...
)

Any thoughts?

Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited

RIght after I'm doing python manage.py collectstatic, this happens:

(djangocms)djangocms@68edd942011c:/home/djangocms/djangocms# python manage.py collectstatic
/home/djangocms/djangocms/local/lib/python2.7/site-packages/media_tree/settings.py:95: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9.
  ('large', (400, 400)),

/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/utils/datastructures.py:233: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9.
  return self.__class__(self)

/home/djangocms/djangocms/local/lib/python2.7/site-packages/media_tree/utils/__init__.py:3: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
  from django.utils.importlib import import_module

Traceback (most recent call last):                                                                                                                                                                                        [34/392]
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 328, in execute
    django.setup()
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
    app_config.ready()
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 22, in ready
    self.module.autodiscover()
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/media_tree/admin/__init__.py", line 1, in <module>
    from media_tree.admin.filenode_admin import *
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/media_tree/admin/filenode_admin.py", line 18, in <module>
    from media_tree.forms import FolderForm, FileForm, UploadForm
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/media_tree/forms.py", line 9, in <module>
    class FolderForm(forms.ModelForm):
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/forms/models.py", line 274, in __new__
    "needs updating." % name
django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form FolderForm needs updating.
(djangocms)root@68edd942011c:/home/djangocms/djangocms# python manage.py collectstatic > dump
/home/djangocms/djangocms/local/lib/python2.7/site-packages/media_tree/settings.py:95: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9.
  ('large', (400, 400)),

/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/utils/datastructures.py:233: RemovedInDjango19Warning: SortedDict is deprecated and will be removed in Django 1.9.
  return self.__class__(self)
/home/djangocms/djangocms/local/lib/python2.7/site-packages/media_tree/utils/__init__.py:3: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
  from django.utils.importlib import import_module

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 328, in execute
    django.setup()
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
    app_config.ready()
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 22, in ready
    self.module.autodiscover()
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/media_tree/admin/__init__.py", line 1, in <module>
    from media_tree.admin.filenode_admin import *
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/media_tree/admin/filenode_admin.py", line 18, in <module>
    from media_tree.forms import FolderForm, FileForm, UploadForm
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/media_tree/forms.py", line 9, in <module>
    class FolderForm(forms.ModelForm):
  File "/home/djangocms/djangocms/local/lib/python2.7/site-packages/django/forms/models.py", line 274, in __new__
    "needs updating." % name
django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form FolderForm needs updating.

Using: Django 1.8

AttributeError 'User' object has no attribute 'message_set'

Hello, I use Django-CMS 2.3 & Zinnia 0.11.1.

I installed last version media-tree and I can't open ch. "Media objects" on my site - I get error

Request URL: http://127.0.0.1:8000/admin/media_tree/filenode/
Django Version: 1.4.1
Exception Type: AttributeError
Exception Value:
'User' object has no attribute 'message_set'
Exception Location: /usr/local/lib/python2.7/site-packages/django/utils/functional.py in inner, line 185

Today I created new Django-project and have added media-tree. Just such error been there.

I checked settings of messages framework all were ok. What can I still do?

Command to add file from filesystem

Alo!

Do you have any plan to create a command/option to insert files in filesystem in database?

Have you got some suggestion? Maybe it could an option of mediaorphaned command..

Thank you,
Vince

Media Tree Slideshow doesn't show link

I have setup media tree with django-cms. It's work fine but I found some problem when I add Link to slide, no link are shown but when i try to add normal image with link, it's work fine

Thanks

Django 1.8 support? (aka "form MediaTreeImagePluginForm needs updating")

I'm trying to get django-media-tree working with Django 1.8.3 and django CMS 3.1.2 (with Python 2.7.5), and I'm getting the following errors for all cms-plugins:

  ...
  File "<...>/site-packages/media_tree/contrib/cms_plugins/media_tree_image/cms_plugins.py", line 14, in <module>
    class MediaTreeImagePluginForm(MediaTreePluginFormBase):
  File "<...>/site-packages/django/forms/models.py", line 274, in __new__
    "needs updating." % name
django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form MediaTreeImagePluginForm needs updating.

This analogously affects all cms-plugins,

  • MediaTreeImagePluginForm
  • MediaTreeSlideshowPluginForm
  • MediaTreeGalleryPluginForm
  • MediaTreeListingPluginForm

Fixing the issue for Django 1.8

The reasons and the fix are described on StackOverflow. It's a backwards-incompatible change from Django 1.7 to 1.8.

I see there hasn't been a lot of activity on this project this year. Hence, most probably Django 1.8 compatibility has not been tackled yet. I'm going to prepare a pull request.

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.