from django.conf.urls import url
from .views import (upload_photo_artist, delete_photo_artist,
                    AlbumListView, CreateAlbumView)


urlpatterns = [
    url(r'^upload/?$', upload_photo_artist, name='upload_photo_artist'),
    url(r'^(?P<photo_id>\d+)/delete/$', delete_photo_artist, name='delete_photo_artist'),
    url(r'^album/(?P<user_pk>\d+)/$', AlbumListView.as_view(), name='list_artist_albums'),
    url(r'^create-album/$', CreateAlbumView.as_view(), name='create_album')
]

from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from .views import (upload_photo_artist, delete_photo_artist,
                    AlbumListView, CreateAlbumView)


urlpatterns = [
    url(r'^upload/?$', upload_photo_artist, name='upload_photo_artist'),
    url(r'^(?P<photo_id>\d+)/delete/$', delete_photo_artist, name='delete_photo_artist'),
    url(r'^album/(?P<user_pk>\d+)/$', AlbumListView.as_view(), name='list_artist_albums'),
    url(r'^create-album/$', login_required(CreateAlbumView.as_view()), name='create_album')
]

Add login requirement on create album view
Add login requirement on create album view

  from django.conf.urls import url
+ from django.contrib.auth.decorators import login_required
  from .views import (upload_photo_artist, delete_photo_artist,
                      AlbumListView, CreateAlbumView)
  
  
  urlpatterns = [
      url(r'^upload/?$', upload_photo_artist, name='upload_photo_artist'),
      url(r'^(?P<photo_id>\d+)/delete/$', delete_photo_artist, name='delete_photo_artist'),
      url(r'^album/(?P<user_pk>\d+)/$', AlbumListView.as_view(), name='list_artist_albums'),
-     url(r'^create-album/$', CreateAlbumView.as_view(), name='create_album')
+     url(r'^create-album/$', login_required(CreateAlbumView.as_view()), name='create_album')
  ]
  
Add login requirement on create album view
## Code Before:
from django.conf.urls import url
from .views import (upload_photo_artist, delete_photo_artist,
                    AlbumListView, CreateAlbumView)


urlpatterns = [
    url(r'^upload/?$', upload_photo_artist, name='upload_photo_artist'),
    url(r'^(?P<photo_id>\d+)/delete/$', delete_photo_artist, name='delete_photo_artist'),
    url(r'^album/(?P<user_pk>\d+)/$', AlbumListView.as_view(), name='list_artist_albums'),
    url(r'^create-album/$', CreateAlbumView.as_view(), name='create_album')
]

## Instruction:
Add login requirement on create album view
## Code After:
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from .views import (upload_photo_artist, delete_photo_artist,
                    AlbumListView, CreateAlbumView)


urlpatterns = [
    url(r'^upload/?$', upload_photo_artist, name='upload_photo_artist'),
    url(r'^(?P<photo_id>\d+)/delete/$', delete_photo_artist, name='delete_photo_artist'),
    url(r'^album/(?P<user_pk>\d+)/$', AlbumListView.as_view(), name='list_artist_albums'),
    url(r'^create-album/$', login_required(CreateAlbumView.as_view()), name='create_album')
]
