Example #1
0
# -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import *
from django.contrib.staticfiles.urls import static
from django.contrib import admin
from filebrowser.sites import FileBrowserSite
from crm.views import *
from accounting.views import *
from django.core.files.storage import DefaultStorage

site = FileBrowserSite(name="filebrowser", storage=DefaultStorage())
customsite = FileBrowserSite(name='custom_filebrowser', storage=DefaultStorage())
customsite.directory = "uploads/"


admin.autodiscover()

urlpatterns = [
    url(r'^admin/filebrowser/', customsite.urls),
    url(r'^admin/', admin.site.urls),
]
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
Example #2
0
    def fileobject_is_used_by(self, fileobject):
        if fileobject.filetype == 'Folder':
            return []
        filename = fileobject.name
        used_by = []
        for classname, attr_names in settings.IMAGE_FIELDS:
            for attr_name in attr_names:
                used_by += eval(classname).objects.filter(**{
                    attr_name: filename
                }).all()
        # the image can also be used by one of the text fields
        for classname, attr_names in settings.TEXT_FIELDS:
            for attr_name in attr_names:
                used_by += eval(classname).objects.filter(
                    **{
                        attr_name + '__icontains': filename
                    }).all()

        return used_by


site = FileBrowserSite(name='filebrowser', storage=storage)

# Default actions
site.add_action(flip_horizontal)
site.add_action(flip_vertical)
site.add_action(rotate_90_clockwise)
site.add_action(rotate_90_counterclockwise)
site.add_action(rotate_180)
Example #3
0
from django.conf.urls import include, url
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic import RedirectView
from django.contrib import admin
from filebrowser.sites import site
from filebrowser.sites import FileBrowserSite
from django.core.files.storage import DefaultStorage

# django_version=="2.1"
urlpatterns = [
    path('test-history/', site.urls),
    path('admin/', admin.site.urls),
    path('cws/', include('coverage_websys_func.urls')),
    path('', RedirectView.as_view(url='/cws', permanent=True)),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)

# config admin page
admin.site.site_header = 'Coverage - Test Web System Admin'
admin.site.index_title = 'coverage - test web system '
admin.site.site_title = 'administration'

#
c_site = FileBrowserSite(name='FB',
                         app_name='filebrowser',
                         storage=DefaultStorage())
Example #4
0
from django.conf.urls import include, url
from filebrowser.sites import site
from django.contrib import admin
from django.core.files.storage import DefaultStorage
from filebrowser.sites import FileBrowserSite
from views import MyIndexView
from opress.views import *

# Default FileBrowser site
site = FileBrowserSite(name='[:SAMPLE_PROJECT:]', storage=DefaultStorage())
site.directory = "uploads/"

urlpatterns = [
    url(r'^grappelli/', include('grappelli.urls')),
    url(r'^photologue/', include('photologue.urls', namespace='photologue')),
    url(r'^tinymce/', include('tinymce.urls')),
    url(r'^admin/filebrowser/', include(site.urls)),
    url(r'^$', MyIndexView.as_view(), name='index'),
    url(r'^', include('opress.urls', namespace='opress')),
    url(r'^admin/', include(admin.site.urls)),
]

handler404 = 'opress.views.error404'