示例#1
0
try:
    from django.conf.urls import url
except ImportError:
    # for Django version less than 1.4
    from django.conf.urls.defaults import url, patterns

from redactor.views import RedactorUploadView
from redactor.forms import FileForm, ImageForm


urlpatterns = [
    url(r'^upload/image/(?P<upload_to>.*)',
        RedactorUploadView.as_view(form_class=ImageForm),
        name='redactor_upload_image'),

    url(r'^upload/file/(?P<upload_to>.*)',
        RedactorUploadView.as_view(form_class=FileForm),
        name='redactor_upload_file'),
]
示例#2
0
try:
    from django.conf.urls import url, patterns
except ImportError:
    # for Django version less than 1.4
    from django.conf.urls.defaults import url, patterns

from redactor.views import RedactorUploadView
from redactor.forms import FileForm, ImageForm

urlpatterns = patterns(
    '',
    url('^upload/image/(?P<upload_to>.*)',
        RedactorUploadView.as_view(
            form_class=ImageForm,
            response=lambda name, url: '<img src="{0}" alt="{1}" />'.format(
                url, name)),
        name='redactor_upload_image'),
    url('^upload/file/(?P<upload_to>.*)',
        RedactorUploadView.as_view(form_class=FileForm,
                                   response=lambda name, url:
                                   '<a href="{0}">{1}</a>'.format(url, name)),
        name='redactor_upload_file'),
)
示例#3
0
from django.conf.urls import url

from redactor.views import RedactorUploadView
from redactor.forms import FileForm, ImageForm

urlpatterns = [
    url(r'^upload/image/(?P<upload_to>)',
        RedactorUploadView.as_view(),
        name='redactor_upload_image'),
    url(r'^upload/file/(?P<upload_to>)',
        RedactorUploadView.as_view(),
        name='redactor_upload_file'),
]
示例#4
0
文件: urls.py 项目: JamesX88/tes
try:
    from django.conf.urls import url, patterns
except ImportError:
    # for Django version less than 1.4
    from django.conf.urls.defaults import url, patterns

from redactor.views import RedactorUploadView
from redactor.forms import FileForm, ImageForm


urlpatterns = patterns('',
    url('^upload/image/(?P<upload_to>.*)',
        RedactorUploadView.as_view(form_class=ImageForm,
                                   response=lambda name, url: '<img src="{0}" alt="{1}" />'.format(url, name)),
        name='redactor_upload_image'),

    url('^upload/file/(?P<upload_to>.*)',
        RedactorUploadView.as_view(form_class=FileForm,
                                   response=lambda name, url: '<a href="{0}">{1}</a>'.format(url, name)),
        name='redactor_upload_file'),
)