• Stars
    star
    137
  • Rank 266,121 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 11 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple Django app to browse files on server

Filemanager

travis Requirements Status Coverage Status

Filemanager is a simple Django app to browse files on server. You can also integrate this filemanager with CKEditor.

Requirements

  • Python (2.7, 3.4, 3.5, 3.6, 3.7)
  • Django (1.8, 1.11)

Screenshot

screenshot

Quick start

Install it by

pip install -e git+https://github.com/IMGIITRoorkee/django-filemanager.git#egg=django-filemanager

Add "filemanager" to your INSTALLED_APPS setting like this::

INSTALLED_APPS = (
    ...
    'filemanager',
)

Usage

  • As a filemanager : To upload files on server by a user to a directory and let him manage his directory by adding, renaming and deleting files and folders inside it.

  • Integrating it with CKEditor for the functionality of "Browse Server".

As a filemanager

In urls.py of your app to make filemanager run at url /abc/.

from django.conf.urls import url

from filemanager import path_end
from views import view

urlpatterns = (
   .
   .
   url(r'^abc/' + path_end, view, name='view'),
)

Then write the view in views.py of your app:

from django.conf import settings

from filemanager import FileManager


def view(request, path):
    extensions = ['html', 'htm', 'zip', 'py', 'css', 'js', 'jpeg', 'jpg', 'png']
    fm = FileManager(settings.MEDIA_ROOT, extensions=extensions)
    return fm.render(request, path)

And it is done, you can find above code in tests directory.

Adding constraints to Filemanager : FileManager __init__ is defined as:

def __init__(self, basepath, ckeditor_baseurl='', maxfolders=50, maxspace=5 * 1024, maxfilesize=1 * 1024,
             public_url_base=None, extensions=None):
    """
    basepath: User's directory basepath in server.
    maxfolders: Maximum number of total nested folders allowed inside the user directory.
    maxspace (in KB): Maximum space allowed for the user directory.
    maxfilesize (in KB): Limit for the size of an uploaded file allowed in user directory.
    extensions: List of extensions allowed. Ex. ['pdf','html'] etc.
    public_base_url: A base_url if given there will be an option to copy file url with the given url_base.
    """

Hence one should also pass arguments like maxfolders, maxspace, maxfilesize if one doesn't want to use the default ones. If extensions list is not passed then all file-extensions are allowed for upload.

Integrating with CKEditor

Use filemanager.models.CKEditorField field in you model. Or you can use filemanager.widgets.CKEditorWidget as a widget for CKEditor in forms. Both classes can take an extra argument filemanager_url while making instances from them.

Suppose you want to run filemanager at url /abc/ in your app then make changes in urls.py and views.py like above. Then in CKEditorField or CKEditorWidget pass the url of filemanager as argument filemanager_url. For example in models.py:

from django.db import models

from filemanager.models import CKEditorField


class MyModel(models.Model):
    content = CKEditorField(filemanager_url='/app/abc/')

More Repositories

1

omniport-backend

The Django backend of the one true portal for any and every educational institute
Python
68
star
2

pr-mod

Reviewing pull-requests made much easier now!
Python
38
star
3

omniport-docker

The Dockerised setup of the one true portal for any and every educational institute
Shell
37
star
4

omniport-frontend

The React frontend of the one true portal for any and every educational institute
JavaScript
33
star
5

omniport-frontend-formula-one

The design language of Omniport, expressed as a collection of frequently-used UI components
JavaScript
27
star
6

img-2020-lecture-series

The lecture series and assignments for the year 2020 at IMG
HTML
27
star
7

omniport-shell

A layer of customisations and overrides to tailor Omniport to the specific needs of IIT Roorkee
Python
23
star
8

omniport-docs

The Sphinx documentation of the one true portal for any and every educational institute
23
star
9

omniport-service-developer

Backend for the developer service in Omniport
Python
15
star
10

workshop2017

Reading material, instructions and code for the Workshop 2017
PHP
14
star
11

omniport-frontend-oauth

Frontend for the OAuth service in Omniport
JavaScript
14
star
12

omniport-service-comments

A generic commenting system which can be used with any app
Python
14
star
13

omniport-frontend-groups

Frontend for the groups service in Omniport
JavaScript
14
star
14

omniport-frontend-helpcentre

JavaScript
13
star
15

omniport-service-links

Backend for the links service in Omniport
Python
13
star
16

omniport-service-groups

Backend for the groups service in Omniport
Python
13
star
17

omniport-service-feed

Backend for the feed service in Omniport
Python
13
star
18

omniport-frontend-links

Frontend for the links service in Omniport
JavaScript
13
star
19

omniport-frontend-feed

Frontend for the feed service in Omniport
JavaScript
13
star
20

omniport-frontend-settings

Frontend for the settings service in Omniport
JavaScript
13
star
21

omniport-frontend-developer

Frontend for the developer service in Omniport
JavaScript
12
star
22

omniport-service-settings

Backend for the settings service in Omniport
Python
12
star
23

Pocket-Channeli

Now accessing your intranet applications and staying in sync with Channel-I is easier than ever before!
JavaScript
12
star
24

omniport-service-yellow-pages

Backend for the yellow pages service in Omniport
Python
11
star
25

omniport-app-template

This is the template for Omniport backend apps
Python
11
star
26

omniport-frontend-alohomora

Frontend for the Alohomora app in Omniport
JavaScript
11
star
27

omniport-frontend-auth

Frontend for the authentication service in Omniport
JavaScript
11
star
28

omniport-frontend-terms-of-use

Frontend for the terms of use service in Omniport
JavaScript
10
star
29

omniport-frontend-template

This is the template for Omniport frontend apps
JavaScript
10
star
30

omniport-service-helpcentre

Backend for the helpcentre service in Omniport
Python
10
star
31

omniport-service-gif

Backend for the GIF service in Omniport
Python
10
star
32

omniport-frontend-apps

Frontend for the apps service in Omniport
JavaScript
10
star
33

workshop2018

Reading material, instructions and code for the Workshop 2018
PHP
9
star
34

omniport-backend-formula-one

The backend blocks of Omniport, expressed as a collection of frequently-used classes and functions
Python
9
star
35

pr-mod-chrome-extension

chrome extension for pr-mod
JavaScript
8
star
36

omniport-service-apps

Backend for the apps service in Omniport
Python
7
star
37

omniport-app-noticeboard

Python
6
star
38

site

HTML
6
star
39

omniport-app-alohomora

Backend for the Alohomora app in Omniport
Python
5
star
40

open-source-arcade

Help begineers start with open source contributions.
JavaScript
5
star
41

chakra-library

HTML
3
star
42

omniport-app-buy-and-sell

Python
3
star
43

omniport-frontend-noticeboard

JavaScript
3
star
44

placement-flutter

The official placement mobile application of Indian Institute of Technology Roorkee
Dart
3
star
45

omniport-service-categories

Backend for the categories service in Omniport
Python
3
star
46

IMG-Stream

Stream and control youtube videos inside a LAN environment. Useful tool if you have only single comp connected to speaker .
JavaScript
3
star
47

omniport-frontend-no-dues

The app digitise the process of obtaining no dues at IITR
JavaScript
3
star
48

omniport-frontend-buy-and-sell

JavaScript
3
star
49

omniport-setup-cli

JavaScript
2
star
50

noticeboard-mobile-app

The official revamped Noticeboard Mobile App of Indian Institute of Technology Roorkee
Dart
2
star
51

omniport-service-notifications

Backend for the notification service in Omniport
Python
2
star
52

workshop2019

PHP
1
star
53

omniport-app-no-dues

The app digitise the process of obtaining no dues at IITR
Python
1
star
54

omniport-app-faculty-profile

Python
1
star
55

nobel

A messaging app to see if people are present in a remote location
JavaScript
1
star
56

omniport-frontend-people_search

JavaScript
1
star
57

django-static-precompile

Static files precompiler for django
Python
1
star