示例#1
0
 def test_library_view(self):
     """Test library route."""
     from imager_images.views import LibraryView
     request = self.request.get('')
     request.user = self.test_user
     library_view = LibraryView.as_view()
     response = library_view(request)
     self.assertEqual(response.status_code, 200)
示例#2
0
 def test_libary_view_returns_200(self):
     """Test Library View returns a 200."""
     user = UserFactory.create()
     user.save()
     view = LibraryView.as_view()
     req = self.request.get(reverse_lazy('library'))
     req.user = user
     response = view(req)
     self.assertTrue(response.status_code == 200)
示例#3
0
 def test_library_route_is_status_ok(self):
     """Test that library view status code is 200."""
     from imager_images.views import LibraryView
     test_user = self.add_test_user()
     self.client.force_login(test_user)
     request = self.request.get(reverse_lazy("library"))
     request.user = test_user
     view = LibraryView.as_view()
     response = view(request)
     self.assertTrue(response.status_code == 200)
示例#4
0
"""Urls for imager_images app."""
from django.conf.urls import url

from django.contrib.auth.decorators import login_required

from imager_images.views import AlbumInfo, AlbumsView, CreateAlbum, CreatePhoto, EditAlbum, EditPhoto, LibraryView, PhotoInfo, PhotosView

urlpatterns = [
    url(r'^library/$', LibraryView.as_view(), name='library'),
    url(r'^photos/$', PhotosView.as_view(), name='photos'),
    url(r'^albums/$', AlbumsView.as_view(), name='albums'),
    url(r'^photos/(?P<pk>\d+)$', PhotoInfo.as_view(), name='photo_info'),
    url(r'^albums/(?P<pk>\d+)$', AlbumInfo.as_view(), name='album_info'),
    url(r'^photos/add/$',
        login_required(CreatePhoto.as_view()),
        name='create_photo'),
    url(r'^albums/add/$',
        login_required(CreateAlbum.as_view()),
        name='create_album'),
    url(r'^photos/(?P<pk>\d+)/edit/$',
        login_required(EditPhoto.as_view()),
        name='edit_photo'),
    url(r'^albums/(?P<pk>\d+)/edit/$',
        login_required(EditAlbum.as_view()),
        name='edit_album')
]
示例#5
0
from imager_images.views import (LibraryView,
                                 SinglePhotoView,
                                 SingleAlbumView,
                                 PhotoCreate,
                                 AlbumCreate,
                                 PhotoEdit,
                                 AlbumEdit,
                                 PhotoTagListView,
                                 AlbumTagListView,
                                 PhotosView,
                                 AlbumsView
                                 )


urlpatterns = [
    url(r'^library/', login_required(LibraryView.as_view()),
        name='library'),
    url(r'^photos/$', PhotosView.as_view(), name='photos'),
    url(r'^albums/$', AlbumsView.as_view(), name='albums'),
    url(r'^photos/(?P<pk>\d+)/$', login_required(SinglePhotoView.as_view()),
        name='photo'),
    url(r'^albums/(?P<pk>\d+)/$', login_required(SingleAlbumView.as_view()),
        name='album'),
    url(r'^photos/tags/(?P<slug>\w*\d*)/$', login_required(PhotoTagListView.as_view()),
        name='tagged_photos'),
    url(r'^albums/tags/(?P<slug>\w*\d*)/$', login_required(AlbumTagListView.as_view()),
        name='tagged_albums'),
    url(r'^photo/add/$', login_required(PhotoCreate.as_view()),
        name='add_photo'),
    url(r'^album/add/$', login_required(AlbumCreate.as_view()),
        name='add_album'),
示例#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
    url(r'^admin/', admin.site.urls),
    url(r'^$', HomeView.as_view(), name='homepage'),
    url(r'^profile/edit$', UpdateProfile.as_view(), name='edit-profile'),
    url(r'^profile/(?P<username>[\w\_\-]+)',
        OneProfileView.as_view(),
        name='profile'),
    url(r'^profile/$', views.profile_view, name='profile'),
    url(r'^images/album/(?P<pk>\w)/edit',
        UpdateAlbum.as_view(),
        name='edit-album'),
    url(r'^images/photo/(?P<pk>\w)/edit',
        UpdatePhoto.as_view(),
        name='edit-photo'),
    url(r'^images/photos/add/', PhotoForm.as_view(), name='add-photo'),
    url(r'^images/albums/add/', AlbumForm.as_view(), name='add-album'),
    url(r'^images/library/$', LibraryView.as_view(), name='library'),
    url(r'^images/photos/(?P<pk>\d+)/$',
        SinglePhotoView.as_view(),
        name='single-photo'),
    url(r'^images/albums/(?P<pk>\d+)/$',
        SingleAlbumView.as_view(),
        name='single-album'),
    url(r'^images/photos/', PublicPhotosView.as_view(), name='public-photos'),
    url(r'^images/albums/', PublicAlbumsView.as_view(), name='public-albums'),
    url(r'^login/$',
        auth_views.login, {'template_name': 'registration/login.html'},
        name='login'),
    url(r'^logout/', LogoutView.as_view(), name='logout'),
    url(r'^accounts/', include('registration.backends.hmac.urls'))
]
示例#8
0
"""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)
示例#9
0
#!/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')
)
示例#10
0
"""Images URLS."""

from django.conf.urls import url
from imager_images.views import (LibraryView, AlbumView, PhotoView,
                                 AlbumFormView, PhotoFormView, PublicPhotos,
                                 PublicAlbums, AlbumEditView, PhotoEditView)

urlpatterns = [
    url(r'library', LibraryView.as_view(), name='library'),
    url(r'library/(?P<user_search>[a-zA-Z0-9_.-]+$)', LibraryView.as_view()),
    url(r'^album/(?P<pk>\d+)', AlbumView.as_view(), name='album'),
    url(r'^albums/(?P<pk>\d+)/edit',
        AlbumEditView.as_view(),
        name='album_edit'),
    url(r'^photo/(?P<pk>\d+)', PhotoView.as_view(), name='photo'),
    url(r'^photos/(?P<pk>\d+)/edit',
        PhotoEditView.as_view(),
        name='photo_edit'),
    url(r'^album/add$', AlbumFormView.as_view(), name='new_album'),
    url(r'^photo/add$', PhotoFormView.as_view(), name='new_photo'),
    url(r'photos', PublicPhotos.as_view(), name='public_photos'),
    url(r'albums', PublicAlbums.as_view(), name='public_albums'),
]
示例#11
0
"""Routes for user public images."""
from django.conf.urls import url
from imager_images.views import LibraryView
from imager_images.views import AlbumsView
from imager_images.views import AlbumView
from imager_images.views import AlbumAdd
from imager_images.views import PhotoAdd
from imager_images.views import PhotoEdit
from imager_images.views import AlbumEdit, PhotosView

urlpatterns = [
    url(r'^library/(?P<album_page_num>\d*)/(?P<photo_page_num>\d*)$',
        LibraryView.as_view(),
        name='library'),
    url(r'^photos/page/(?P<page_num>\d*)$',
        PhotosView.as_view(),
        name='photos'),
    url(r'^albums/page/(?P<page_num>\d*)$',
        AlbumsView.as_view(),
        name='albums'),
    url(r'^album/(?P<album_id>\d+)/(?P<page_num>\d*)$',
        AlbumView.as_view(),
        name='album'),
    url(r'^photos/add/$', PhotoAdd.as_view(), name='photo_add'),
    url(r'^albums/add/$', AlbumAdd.as_view(), name='album_add'),
    url(r'^photos/(?P<photo_id>\d+)/edit/$',
        PhotoEdit.as_view(),
        name='photo_edit'),
    url(r'^albums/(?P<album_id>\d+)/edit/$',
        AlbumEdit.as_view(),
        name='album_edit'),