예제 #1
0
파일: urls.py 프로젝트: Kauhia/gallery
from django.conf.urls import include, url
from images import views
from images.views import ImageCreate, ImageListView

urlpatterns = [
    url(r'add/$', ImageCreate.as_view(), name='image-add'),
    url(r'$', ImageListView.as_view(), name='image-list'),
]
예제 #2
0
# -*- coding: utf-8 -*-
"""
URLs to manage accounts.
"""
from __future__ import unicode_literals

from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django.views.generic import RedirectView

from images.views import ImageDetailView, ImageListView
from images.views import multi_image_upload, delete_image, image_detail_raw, latest_images

urlpatterns = patterns(
    '',
    url(r'^upload/$', login_required(multi_image_upload), name='upload'),
    url(r'^list/$', login_required(ImageListView.as_view()), name='image_list'),
    url(r'^list/latest/?$', login_required(latest_images), name='latest_images'),
    url(r'^(?P<slug>[\d\w]+)/$', ImageDetailView.as_view(), name='image_detail'),
    url(r'^(?P<slug>[\d\w]+).(?P<extension>[\w]{3,4})$', image_detail_raw, name='image_detail_raw'),
    url(r'^(?P<slug>[\d\w]+)/delete/$', delete_image, name='image_delete'),
    url(r'^$', RedirectView.as_view(pattern_name='images:upload', permanent=False), name='index')
)
예제 #3
0
파일: urls.py 프로젝트: jskopek/frame
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from images.views import ImageUploaderView
from images.views import ImageListView
from images.views import ImageView
from django.views.decorators.csrf import csrf_exempt

urlpatterns = patterns('',
    #url(r'^$', csrf_exempt(ImageUploaderView.as_view())),
    url(r'^$', ImageUploaderView.as_view(), name='upload'),
    url(r'list/$', ImageListView.as_view(), name='list'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^image/(?P<image_identifier>[^/]+)/$', ImageView.as_view(), name='image'),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    url(r'^local_image/', include('db_storage.urls')),
) 

# apply authentication middleware on everything but the image urls
from urlmiddleware.conf import middleware, mpatterns
middlewarepatterns = mpatterns('',
    middleware(r'^(?!image)', 'django.contrib.sessions.middleware.SessionMiddleware'),
    middleware(r'^(?!image)', 'django.contrib.auth.middleware.AuthenticationMiddleware'),
    middleware(r'^(?!image)', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware'),
    middleware(r'^(?!image)', 'django.contrib.messages.middleware.MessageMiddleware'),
)

# Serving Locally Stored Media Files
# ----------------------------------
# media files are served from the media directory via dj_static. The configuration
# can be found in frame/wsgi.py
예제 #4
0
파일: urls.py 프로젝트: Kauhia/gallery
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin
from images import urls
from images.views import ImageListView
from comments.views import DetailImageAndCreateComment
from django.conf import settings

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^images/(?P<pk>[0-9]+)/$', DetailImageAndCreateComment.as_view(), name='image-comments'),
    url(r'^images/', include('images.urls')),
]

# to make django serve the uploaded images, not a solution for production.
if settings.ENV == 'dev':
    urlpatterns += [url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT,})]

#as last url it will not block others:
urlpatterns += [url(r'^', ImageListView.as_view()),]
예제 #5
0
from __future__ import unicode_literals

from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.views.generic import RedirectView

from images.views import ImageDetailView, ImageListView
from images.views import multi_image_upload, delete_image, image_detail_raw, latest_images

app_name = 'images'

urlpatterns = (url(r'^upload/$',
                   login_required(multi_image_upload),
                   name='upload'),
               url(r'^list/$',
                   login_required(ImageListView.as_view()),
                   name='image_list'),
               url(r'^list/latest/?$',
                   login_required(latest_images),
                   name='latest_images'),
               url(r'^(?P<slug>[\d\w]+)/$',
                   ImageDetailView.as_view(),
                   name='image_detail'),
               url(r'^(?P<slug>[\d\w]+).(?P<extension>[\w]{3,4})$',
                   image_detail_raw,
                   name='image_detail_raw'),
               url(r'^(?P<slug>[\d\w]+)/delete/$',
                   delete_image,
                   name='image_delete'),
               url(r'^$',
                   RedirectView.as_view(pattern_name='images:upload',