コード例 #1
0
ファイル: tests.py プロジェクト: zarkle/django-imager
 def test_photo_view(self):
     """Test photo route."""
     from imager_images.views import PhotoView
     request = self.request.get('')
     request.user = self.test_user
     photo_view = PhotoView.as_view()
     response = photo_view(request)
     self.assertEqual(response.status_code, 200)
コード例 #2
0
 def test_photo_view_doesnt_return_private_photos(self):
     """Test that the photo view doesnt return private photos."""
     image = ImageFactory()
     image.published = 'private'
     image.save()
     req = self.request.get(reverse_lazy('photos'))
     view = PhotoView.as_view()
     response = view(req)
     self.assertTrue(response.context_data['photos'].count() == 0)
コード例 #3
0
 def test_photo_view_returns_public_photos(self):
     """Test that the photo view returns public photos."""
     image = ImageFactory()
     image.published = 'public'
     image.save()
     req = self.request.get(reverse_lazy('photos'))
     view = PhotoView.as_view()
     response = view(req)
     self.assertTrue(response.context_data['photos'].count() == 1)
コード例 #4
0
ファイル: urls.py プロジェクト: ndraper2/django-imager
from django.conf.urls import url
from imager_images.views import (PhotoView, AlbumView, AlbumEditView,
                                 PhotoEditView, AlbumAddView, PhotoAddView)
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView

urlpatterns = [
    url(r'^photos/(?P<pk>\d+)/$',
        login_required(PhotoView.as_view()),
        name='photo_detail'),
    url(r'^library/', login_required(TemplateView.as_view(
                                     template_name='library.html')),
        name='library'),
    url(r'^album/(?P<pk>\d+)/$',
        login_required(AlbumView.as_view()),
        name='album_detail'),
    url(r'^album/add/$', login_required(AlbumAddView.as_view()),
        name='album_add'),
    url(r'^photos/add/$', login_required(PhotoAddView.as_view()),
        name='photo_add'),
    url(r'^album/edit/(?P<pk>\d+)/$', login_required(AlbumEditView.as_view()),
        {'success_url': 'album_detail'}, name='album_edit'),
    url(r'^photos/edit/(?P<pk>\d+)/$',
        login_required(PhotoEditView.as_view()),
        {'success_url': 'photo_detail'}, name='photo_edit'),
    url(r'^photos/(?P<pk>\d+)/detect$', PhotoView.as_view(detect=True),
        name='detect_faces')
]
コード例 #5
0
"""Imager images app urls."""
from django.conf.urls import url

from imager_images.views import (AlbumUpdate, AlbumView, LibraryView,
                                 NewAlbumView, NewPhotoView, PhotoUpdate,
                                 PhotoView)

urlpatterns = [
    url(r'^library/$', LibraryView.as_view(), name='library'),
    url(r'^albums/(?P<pk>\d+)/$', AlbumView.as_view(), name='album'),
    url(r'^photos/(?P<pk>\d+)/$', PhotoView.as_view(), name='photo'),
    url(r'^albums/add/$', NewAlbumView.as_view(), name='album_form'),
    url(r'^photos/add/$', NewPhotoView.as_view(), name='photo_form'),
    url(r'^albums/(?P<pk>\d+)/edit/$',
        AlbumUpdate.as_view(),
        name='album_update'),
    url(r'^photos/(?P<pk>\d+)/edit/$',
        PhotoUpdate.as_view(),
        name='photo_update'),
]
コード例 #6
0
"""Imagersite URL Configuration.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
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. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from imager_images.views import LibraryView, PhotoView, AlbumView, \
    PhotoIdView, AlbumIdView, AddPhotoView, AddAlbumView, PhotoEditView, AlbumEditView

urlpatterns = [
    url(r'^library/$', LibraryView.as_view(), name="library"),
    url(r'^photos/$', PhotoView.as_view(), name="photos"),
    url(r'^albums/$', AlbumView.as_view(), name="albums"),
    url(r'^photos/(?P<pk>\d+)/$', PhotoIdView.as_view(), name="individual_photo"),
    url(r'^albums/(?P<pk>\d+)/$', AlbumIdView.as_view(), name="individual_album"),
    url(r'^albums/add/$', AddAlbumView.as_view(), name="add_albums"),
    url(r'^photos/add/$', AddPhotoView.as_view(), name="add_photos"),
    url(r'^photos/(?P<pk>\d+)/edit/$', PhotoEditView.as_view(), name="edit_photo"),
    url(r'^albums/(?P<pk>\d+)/edit/$', AlbumEditView.as_view(), name="edit_album"),
]
コード例 #7
0
ファイル: urls.py プロジェクト: Loaye/django-imager-group
"""Imager Images urls."""

from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from imager_images.views import AlbumView, LibraryView, PhotoView, EditAlbum, EditImage

urlpatterns = [
    url(r'^library/$',
        LibraryView.as_view(template_name='imager_images/library.html'),
        name='library'),
    url(r'^albums/(?P<pk>\d+)/$',
        AlbumView.as_view(template_name='imager_images/album.html'),
        name='album'),
    url(r'^photos/(?P<pk>\d+)/$',
        PhotoView.as_view(template_name='imager_images/photo.html'),
        name='photo'),
    url(r'^albums/(?P<pk>\d+)/edit/$',
        EditAlbum.as_view(template_name='imager_images/edit_album.html'),
        name='edit_album'),
    url(r'^photos/(?P<pk>\d+)/edit/$',
        EditImage.as_view(template_name='imager_images/edit_photo.html'),
        name='edit_image'),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
コード例 #8
0
ファイル: urls.py プロジェクト: jesseklein406/django-imager
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import unicode_literals
from django.conf.urls import patterns, url
from imager_images.views import LibraryView, PhotoView, AlbumView


urlpatterns = patterns(
    '',
    url(r'^library/$', LibraryView.as_view(), name='library'),
    url(r'^album/(?P<pk>\d+)/$', AlbumView.as_view(), name='album'),
    url(r'^photos/(?P<pk>\d+)/$', PhotoView.as_view(), name='photo')
)
コード例 #9
0
ファイル: urls.py プロジェクト: SakiFu/django-imager
from imager_images.views import (
    PhotoView,
    AlbumView,
    AlbumAddView,
    PhotoAddView,
    AlbumEditView,
    PhotoEditView,
    FaceEditView,
)


urlpatterns = [
    url(r"^$", views.IndexView.as_view(), name="index"),
    url(r"^profile/", include("imager_profile.urls")),
    url(r"^accounts/", include("registration.backends.default.urls")),
    url(r"^admin/", include(admin.site.urls)),
    url(r"^images/", include("imager_images.urls")),
    url(r"^images/album/(?P<pk>\d+)/$", login_required(AlbumView.as_view()), name="album"),
    url(r"^images/album/add/$", login_required(AlbumAddView.as_view()), name="album_add"),
    url(r"^images/album/edit/(?P<pk>\d+)/$", login_required(AlbumEditView.as_view()), name="album_edit"),
    url(r"^images/photos/(?P<pk>\d+)/$", login_required(PhotoView.as_view()), name="photo"),
    url(r"^images/photos/add/$", login_required(PhotoAddView.as_view()), name="photo_add"),
    url(r"^images/photos/edit/(?P<pk>\d+)/$", login_required(PhotoEditView.as_view()), name="photo_edit"),
    url(r"^photos/(?P<pk>\d+)/detect$", PhotoView.as_view(detect=True), name="detect_faces"),
    url(r"^photo/(?P<pk>\d+)/face/edit/$", FaceEditView.as_view(), name="edit_face"),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
コード例 #10
0
ファイル: urls.py プロジェクト: mshinners/django-imager
"""."""
from django.conf.urls import url
from imager_images.views import LibraryView, AlbumView, AlbumDetailView, PhotoView, PhotoDetailView, CreatePhotoView, CreateAlbumView, PhotoEditView, AlbumEditView


urlpatterns = [
    url(r'library/$', LibraryView.as_view(), name='library'),
    url(r'photos/$', PhotoView.as_view(), name='all_photos'),
    url(r'photos/(?P<pk>\d+)$', PhotoDetailView.as_view(), name='detail_photo'),
    url(r'albums/$', AlbumView.as_view(), name='all_albums'),
    url(r'albums/(?P<pk>\d+)$', AlbumDetailView.as_view(), name='detail_album'),
    url(r'create_photo/$', CreatePhotoView.as_view(), name='create_photo'),
    url(r'create_album/$', CreateAlbumView.as_view(), name='create_album'),
    url(r'photos/(?P<pk>\d+)/edit$', PhotoEditView.as_view(), name='edit_photo'),
    url(r'albums/(?P<pk>\d+)/edit$', AlbumEditView.as_view(), name='edit_album'),
]
コード例 #11
0
 def test_photo_view_returns_200(self):
     """Test that the photo view returns a 200."""
     req = self.request.get(reverse_lazy('photos'))
     view = PhotoView.as_view()
     response = view(req)
     self.assertTrue(response.status_code == 200)
コード例 #12
0
ファイル: urls.py プロジェクト: cahudson94/django-imager-1
"""Urls for images."""

from django.conf.urls import url
from imager_images.views import LibraryView, PhotoGalleryView, AlbumGalleryView, PhotoView, AlbumView, AddAlbumView, AddPhotoView, EditPhoto, EditAlbum
urlpatterns = [
    url(r'^library/$', LibraryView.as_view(), name="library"),
    url(r'^photos/$', PhotoGalleryView.as_view(), name="photo_gallery"),
    url(r'^albums/$', AlbumGalleryView.as_view(), name="album_gallery"),
    url(r'^albums/add/$', AddAlbumView.as_view(), name="add_album"),
    url(r'^photos/add/$', AddPhotoView.as_view(), name="add_photo"),
    url(r'^photos/(?P<pk>\d+)/edit/$', EditPhoto.as_view(), name="edit_photo"),
    url(r'^albums/(?P<pk>\d+)/edit/$', EditAlbum.as_view(), name="edit_album"),
    url(r'^photos/(?P<pk>\d+)/$', PhotoView.as_view(), name="photo_view"),
    url(r'^albums/(?P<pk>\d+)/$', AlbumView.as_view(), name="album_view")
]