Commits

Mikhail Korobov  committed fda1f14

use less indentation in README

  • Participants
  • Parent commits d70fdcf

Comments (0)

Files changed (1)

 
 1. Create album site instance and plug it's urls to urlconf:
 
-		from photo_albums.urls import PhotoAlbumSite
-		accounts_photo_site = PhotoAlbumSite(instance_name = 'user_images', 
-                                 queryset = User.objects.all(), 
-                                 template_object_name = 'album_user',
-                                 has_edit_permission = lambda request, obj: request.user==obj) 
-		urlpatterns += patterns('', url(r'^accounts/', include(accounts_photo_site.urls)),)
+	from photo_albums.urls import PhotoAlbumSite
+	accounts_photo_site = PhotoAlbumSite(instance_name = 'user_images', 
+                             queryset = User.objects.all(), 
+                             template_object_name = 'album_user',
+                             has_edit_permission = lambda request, obj: request.user==obj) 
+	urlpatterns += patterns('', url(r'^accounts/', include(accounts_photo_site.urls)),)
 
 Please note that if you deploy multiple albums (ex. for different models), 
 you must provide unique ``instance_name`` for each instance to make url 
 `album_user` is object for which gallery is attached to, `image` is image 
 in gallery):
 
-		{% url user_images:show_album album_user.id %}
-		{% url user_images:edit_album album_user.id %}
-		{% url user_images:upload_main_image album_user.id %}
-		{% url user_images:upload_images album_user.id %}
-		{% url user_images:show_image album_user.id image.id %}
-		{% url user_images:edit_image album_user.id image.id %}
-		{% url user_images:delete_image album_user.id image.id %}
-		{% url user_images:set_as_main_image album_user.id image.id %}
-		{% url user_images:clear_main_image album_user.id image.id %}
-		{% url user_images:reorder_images album_user.id %}
-		{% url user_images:set_image_order album_user.id %}
+	{% url user_images:show_album album_user.id %}
+	{% url user_images:edit_album album_user.id %}
+	{% url user_images:upload_main_image album_user.id %}
+	{% url user_images:upload_images album_user.id %}
+	{% url user_images:show_image album_user.id image.id %}
+	{% url user_images:edit_image album_user.id image.id %}
+	{% url user_images:delete_image album_user.id image.id %}
+	{% url user_images:set_as_main_image album_user.id image.id %}
+	{% url user_images:clear_main_image album_user.id image.id %}
+	{% url user_images:reorder_images album_user.id %}
+	{% url user_images:set_image_order album_user.id %}
 
 
 Templates used by django-photo-albums
 * ``set_image_order`` - ajax view that can be used to implement image reorder
 functionality. Accepts json data in form 
 
-		{'items': '[
-						{"id":"<id1>", "order":"<order1>"},
-						{"id":"<id2>", "order":"<order2>"}, 
-						...
-				    ]'
-	    }
+	{'items': '[
+					{"id":"<id1>", "order":"<order1>"},
+					{"id":"<id2>", "order":"<order2>"}, 
+					...
+			    ]'
+    }
 	    
 and assigns passed order to images with passed id's, with permission checks. 
 
 
 The example usage:
 
-		from accounts.urls import accounts_photo_site
-		from photo_albums import test_utils
+	from accounts.urls import accounts_photo_site
+	from photo_albums import test_utils
+	
+	class UserAlbumTest(test_utils.AlbumTest):
+		# existing user's data
+	    username = 'obiwanus' 
+	    password = 'vasia'
+	    
+	    # fixtures with  to be loaded (at least with users, images and 
+	    # objects with galleries)
+	    fixtures = ['my_fixtures']
+	    
+	    # app instance which is to be tested
+	    album_site = accounts_photo_site
 		
-		class UserAlbumTest(test_utils.AlbumTest):
-			# existing user's data
-		    username = 'obiwanus' 
-		    password = 'vasia'
-		    
-		    # fixtures with  to be loaded (at least with users, images and 
-		    # objects with galleries)
-		    fixtures = ['my_fixtures']
-		    
-		    # app instance which is to be tested
-		    album_site = accounts_photo_site
-			
-			# we don't need edit_image view and don't create template for it
-			# so it should be excluded from testing
-		    excluded_views = ['edit_image']
-		    
-		    # id of object for which album is attached
-		    album_for_id = 4
-		    
-		    # id's of various images: 2 images in album (second is nedded if tou want 
-		    # to test reordering) and one image in other album to test permission checks
-		    image_in_album_id = 48
-		    image2_in_album_id = 66
-		    image_in_other_album_id = 42    
-		        
+		# we don't need edit_image view and don't create template for it
+		# so it should be excluded from testing
+	    excluded_views = ['edit_image']
+	    
+	    # id of object for which album is attached
+	    album_for_id = 4
+	    
+	    # id's of various images: 2 images in album (second is nedded if tou want 
+	    # to test reordering) and one image in other album to test permission checks
+	    image_in_album_id = 48
+	    image2_in_album_id = 66
+	    image_in_other_album_id = 42    
+	        
 If you don't use fixtures you can override setUp method and create necessery 
 objects there.