{"action":"created","comment":{"url":"https://api.github.com/repos/DSIW/sdf/pulls/comments/47392643","id":47392643,"diff_hunk":"@@ -311,3 +312,95 @@ def decline_counteroffer(request, id):\n                          'Der Preisvorschlag wurde erfolgreich abgelehnt. Der Interessent wird benachrichtigt')\n \n     return HttpResponseRedirect(reverse('app_notification:notificationsPage'))\n+\n+\n+def books(request):\n+    template_name = 'app_book/books.html'\n+\n+    filtered_offers = []\n+    filtered_offers.extend(Offer.objects.filter(active=True))\n+\n+    order_dir = request.GET.get('order_dir', '')\n+    order_by = request.GET.get('order_by', '')\n+    page = request.GET.get('page')\n+\n+    direction = True if order_dir == 'desc' else False\n+\n+    if order_by == 'date':\n+        filtered_offers.sort(key=lambda offer: offer.book.created, reverse=direction)\n+    elif order_by == 'title':\n+        filtered_offers.sort(key=lambda offer: offer.book.name.lower(), reverse=direction)\n+    elif order_by == 'author':\n+        filtered_offers.sort(key=lambda offer: offer.book.author.lower(), reverse=direction)\n+    elif order_by == 'price':\n+        filtered_offers.sort(key=lambda offer: (offer.price + offer.shipping_price), reverse=direction)\n+    else:\n+        filtered_offers.sort(key=lambda offer: offer.updated, reverse=direction)\n+\n+    paginator = Paginator(filtered_offers, 3)\n+\n+    try:\n+        offers = paginator.page(page)\n+    except PageNotAnInteger:\n+        offers = paginator.page(1)\n+    except EmptyPage:\n+        offers = paginator.page(paginator.num_pages)\n+\n+    return render_to_response(template_name, {\n+        \"offers\": offers,\n+        \"order_by\": order_by,\n+        \"order_dir\": order_dir,\n+        \"order_comp\": order_by + '-' + order_dir,\n+        \"request\": request,\n+    }, RequestContext(request))\n+\n+\n+def filter_users_with_offered_books(users):\n+    for user in users:\n+        if not user.showcaseDisabled and len(user.offer_set.filter(active=True)) > 0:\n+            yield user\n+\n+\n+def showcasesOverView(request):\n+    template_name = 'app_book/showcaseOverview.html'\n+\n+    filteredUsers = []\n+    filteredUsers.extend(filter_users_with_offered_books(User.objects.all()))\n+\n+    order_dir = request.GET.get('order_dir', '')\n+    order_by = request.GET.get('order_by', '')\n+    page = request.GET.get('page')\n+\n+    direction = True if order_dir == 'desc' else False","path":"app_book/views.py","position":71,"original_position":71,"commit_id":"e17eb77e203cfba9a1d173dbec7d979f10dc7687","original_commit_id":"e17eb77e203cfba9a1d173dbec7d979f10dc7687","user":{"login":"CDanU","id":15148226,"avatar_url":"https://avatars.githubusercontent.com/u/15148226?v=3","gravatar_id":"","url":"https://api.github.com/users/CDanU","html_url":"https://github.com/CDanU","followers_url":"https://api.github.com/users/CDanU/followers","following_url":"https://api.github.com/users/CDanU/following{/other_user}","gists_url":"https://api.github.com/users/CDanU/gists{/gist_id}","starred_url":"https://api.github.com/users/CDanU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CDanU/subscriptions","organizations_url":"https://api.github.com/users/CDanU/orgs","repos_url":"https://api.github.com/users/CDanU/repos","events_url":"https://api.github.com/users/CDanU/events{/privacy}","received_events_url":"https://api.github.com/users/CDanU/received_events","type":"User","site_admin":false},"body":"Done\r\n","created_at":"2015-12-11T19:16:50Z","updated_at":"2015-12-11T19:16:50Z","html_url":"https://github.com/DSIW/sdf/pull/52#discussion_r47392643","pull_request_url":"https://api.github.com/repos/DSIW/sdf/pulls/52","_links":{"self":{"href":"https://api.github.com/repos/DSIW/sdf/pulls/comments/47392643"},"html":{"href":"https://github.com/DSIW/sdf/pull/52#discussion_r47392643"},"pull_request":{"href":"https://api.github.com/repos/DSIW/sdf/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/DSIW/sdf/pulls/52","id":52765591,"html_url":"https://github.com/DSIW/sdf/pull/52","diff_url":"https://github.com/DSIW/sdf/pull/52.diff","patch_url":"https://github.com/DSIW/sdf/pull/52.patch","issue_url":"https://api.github.com/repos/DSIW/sdf/issues/52","number":52,"state":"open","locked":false,"title":"Feature/b27 schaufenster view","user":{"login":"CDanU","id":15148226,"avatar_url":"https://avatars.githubusercontent.com/u/15148226?v=3","gravatar_id":"","url":"https://api.github.com/users/CDanU","html_url":"https://github.com/CDanU","followers_url":"https://api.github.com/users/CDanU/followers","following_url":"https://api.github.com/users/CDanU/following{/other_user}","gists_url":"https://api.github.com/users/CDanU/gists{/gist_id}","starred_url":"https://api.github.com/users/CDanU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CDanU/subscriptions","organizations_url":"https://api.github.com/users/CDanU/orgs","repos_url":"https://api.github.com/users/CDanU/repos","events_url":"https://api.github.com/users/CDanU/events{/privacy}","received_events_url":"https://api.github.com/users/CDanU/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-05T21:44:10Z","updated_at":"2015-12-11T19:16:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"81ae56f3e32e5325b692e5a593cfa329af26f385","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DSIW/sdf/pulls/52/commits","review_comments_url":"https://api.github.com/repos/DSIW/sdf/pulls/52/comments","review_comment_url":"https://api.github.com/repos/DSIW/sdf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DSIW/sdf/issues/52/comments","statuses_url":"https://api.github.com/repos/DSIW/sdf/statuses/e17eb77e203cfba9a1d173dbec7d979f10dc7687","head":{"label":"DSIW:feature/B27-SchaufensterView","ref":"feature/B27-SchaufensterView","sha":"e17eb77e203cfba9a1d173dbec7d979f10dc7687","user":{"login":"DSIW","id":744745,"avatar_url":"https://avatars.githubusercontent.com/u/744745?v=3","gravatar_id":"","url":"https://api.github.com/users/DSIW","html_url":"https://github.com/DSIW","followers_url":"https://api.github.com/users/DSIW/followers","following_url":"https://api.github.com/users/DSIW/following{/other_user}","gists_url":"https://api.github.com/users/DSIW/gists{/gist_id}","starred_url":"https://api.github.com/users/DSIW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DSIW/subscriptions","organizations_url":"https://api.github.com/users/DSIW/orgs","repos_url":"https://api.github.com/users/DSIW/repos","events_url":"https://api.github.com/users/DSIW/events{/privacy}","received_events_url":"https://api.github.com/users/DSIW/received_events","type":"User","site_admin":false},"repo":{"id":44266686,"name":"sdf","full_name":"DSIW/sdf","owner":{"login":"DSIW","id":744745,"avatar_url":"https://avatars.githubusercontent.com/u/744745?v=3","gravatar_id":"","url":"https://api.github.com/users/DSIW","html_url":"https://github.com/DSIW","followers_url":"https://api.github.com/users/DSIW/followers","following_url":"https://api.github.com/users/DSIW/following{/other_user}","gists_url":"https://api.github.com/users/DSIW/gists{/gist_id}","starred_url":"https://api.github.com/users/DSIW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DSIW/subscriptions","organizations_url":"https://api.github.com/users/DSIW/orgs","repos_url":"https://api.github.com/users/DSIW/repos","events_url":"https://api.github.com/users/DSIW/events{/privacy}","received_events_url":"https://api.github.com/users/DSIW/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DSIW/sdf","description":"SecondHandbookBooks (SHB) is a community driven platform for second hand books written in Python.","fork":false,"url":"https://api.github.com/repos/DSIW/sdf","forks_url":"https://api.github.com/repos/DSIW/sdf/forks","keys_url":"https://api.github.com/repos/DSIW/sdf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DSIW/sdf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DSIW/sdf/teams","hooks_url":"https://api.github.com/repos/DSIW/sdf/hooks","issue_events_url":"https://api.github.com/repos/DSIW/sdf/issues/events{/number}","events_url":"https://api.github.com/repos/DSIW/sdf/events","assignees_url":"https://api.github.com/repos/DSIW/sdf/assignees{/user}","branches_url":"https://api.github.com/repos/DSIW/sdf/branches{/branch}","tags_url":"https://api.github.com/repos/DSIW/sdf/tags","blobs_url":"https://api.github.com/repos/DSIW/sdf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DSIW/sdf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DSIW/sdf/git/refs{/sha}","trees_url":"https://api.github.com/repos/DSIW/sdf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DSIW/sdf/statuses/{sha}","languages_url":"https://api.github.com/repos/DSIW/sdf/languages","stargazers_url":"https://api.github.com/repos/DSIW/sdf/stargazers","contributors_url":"https://api.github.com/repos/DSIW/sdf/contributors","subscribers_url":"https://api.github.com/repos/DSIW/sdf/subscribers","subscription_url":"https://api.github.com/repos/DSIW/sdf/subscription","commits_url":"https://api.github.com/repos/DSIW/sdf/commits{/sha}","git_commits_url":"https://api.github.com/repos/DSIW/sdf/git/commits{/sha}","comments_url":"https://api.github.com/repos/DSIW/sdf/comments{/number}","issue_comment_url":"https://api.github.com/repos/DSIW/sdf/issues/comments{/number}","contents_url":"https://api.github.com/repos/DSIW/sdf/contents/{+path}","compare_url":"https://api.github.com/repos/DSIW/sdf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DSIW/sdf/merges","archive_url":"https://api.github.com/repos/DSIW/sdf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DSIW/sdf/downloads","issues_url":"https://api.github.com/repos/DSIW/sdf/issues{/number}","pulls_url":"https://api.github.com/repos/DSIW/sdf/pulls{/number}","milestones_url":"https://api.github.com/repos/DSIW/sdf/milestones{/number}","notifications_url":"https://api.github.com/repos/DSIW/sdf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DSIW/sdf/labels{/name}","releases_url":"https://api.github.com/repos/DSIW/sdf/releases{/id}","created_at":"2015-10-14T18:04:27Z","updated_at":"2015-10-25T23:45:09Z","pushed_at":"2015-12-11T17:08:31Z","git_url":"git://github.com/DSIW/sdf.git","ssh_url":"git@github.com:DSIW/sdf.git","clone_url":"https://github.com/DSIW/sdf.git","svn_url":"https://github.com/DSIW/sdf","homepage":"","size":4998,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"develop"}},"base":{"label":"DSIW:develop","ref":"develop","sha":"a584c57b91e087cb6c7a587f7e4e4a501a146bab","user":{"login":"DSIW","id":744745,"avatar_url":"https://avatars.githubusercontent.com/u/744745?v=3","gravatar_id":"","url":"https://api.github.com/users/DSIW","html_url":"https://github.com/DSIW","followers_url":"https://api.github.com/users/DSIW/followers","following_url":"https://api.github.com/users/DSIW/following{/other_user}","gists_url":"https://api.github.com/users/DSIW/gists{/gist_id}","starred_url":"https://api.github.com/users/DSIW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DSIW/subscriptions","organizations_url":"https://api.github.com/users/DSIW/orgs","repos_url":"https://api.github.com/users/DSIW/repos","events_url":"https://api.github.com/users/DSIW/events{/privacy}","received_events_url":"https://api.github.com/users/DSIW/received_events","type":"User","site_admin":false},"repo":{"id":44266686,"name":"sdf","full_name":"DSIW/sdf","owner":{"login":"DSIW","id":744745,"avatar_url":"https://avatars.githubusercontent.com/u/744745?v=3","gravatar_id":"","url":"https://api.github.com/users/DSIW","html_url":"https://github.com/DSIW","followers_url":"https://api.github.com/users/DSIW/followers","following_url":"https://api.github.com/users/DSIW/following{/other_user}","gists_url":"https://api.github.com/users/DSIW/gists{/gist_id}","starred_url":"https://api.github.com/users/DSIW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DSIW/subscriptions","organizations_url":"https://api.github.com/users/DSIW/orgs","repos_url":"https://api.github.com/users/DSIW/repos","events_url":"https://api.github.com/users/DSIW/events{/privacy}","received_events_url":"https://api.github.com/users/DSIW/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DSIW/sdf","description":"SecondHandbookBooks (SHB) is a community driven platform for second hand books written in Python.","fork":false,"url":"https://api.github.com/repos/DSIW/sdf","forks_url":"https://api.github.com/repos/DSIW/sdf/forks","keys_url":"https://api.github.com/repos/DSIW/sdf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DSIW/sdf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DSIW/sdf/teams","hooks_url":"https://api.github.com/repos/DSIW/sdf/hooks","issue_events_url":"https://api.github.com/repos/DSIW/sdf/issues/events{/number}","events_url":"https://api.github.com/repos/DSIW/sdf/events","assignees_url":"https://api.github.com/repos/DSIW/sdf/assignees{/user}","branches_url":"https://api.github.com/repos/DSIW/sdf/branches{/branch}","tags_url":"https://api.github.com/repos/DSIW/sdf/tags","blobs_url":"https://api.github.com/repos/DSIW/sdf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DSIW/sdf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DSIW/sdf/git/refs{/sha}","trees_url":"https://api.github.com/repos/DSIW/sdf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DSIW/sdf/statuses/{sha}","languages_url":"https://api.github.com/repos/DSIW/sdf/languages","stargazers_url":"https://api.github.com/repos/DSIW/sdf/stargazers","contributors_url":"https://api.github.com/repos/DSIW/sdf/contributors","subscribers_url":"https://api.github.com/repos/DSIW/sdf/subscribers","subscription_url":"https://api.github.com/repos/DSIW/sdf/subscription","commits_url":"https://api.github.com/repos/DSIW/sdf/commits{/sha}","git_commits_url":"https://api.github.com/repos/DSIW/sdf/git/commits{/sha}","comments_url":"https://api.github.com/repos/DSIW/sdf/comments{/number}","issue_comment_url":"https://api.github.com/repos/DSIW/sdf/issues/comments{/number}","contents_url":"https://api.github.com/repos/DSIW/sdf/contents/{+path}","compare_url":"https://api.github.com/repos/DSIW/sdf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DSIW/sdf/merges","archive_url":"https://api.github.com/repos/DSIW/sdf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DSIW/sdf/downloads","issues_url":"https://api.github.com/repos/DSIW/sdf/issues{/number}","pulls_url":"https://api.github.com/repos/DSIW/sdf/pulls{/number}","milestones_url":"https://api.github.com/repos/DSIW/sdf/milestones{/number}","notifications_url":"https://api.github.com/repos/DSIW/sdf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DSIW/sdf/labels{/name}","releases_url":"https://api.github.com/repos/DSIW/sdf/releases{/id}","created_at":"2015-10-14T18:04:27Z","updated_at":"2015-10-25T23:45:09Z","pushed_at":"2015-12-11T17:08:31Z","git_url":"git://github.com/DSIW/sdf.git","ssh_url":"git@github.com:DSIW/sdf.git","clone_url":"https://github.com/DSIW/sdf.git","svn_url":"https://github.com/DSIW/sdf","homepage":"","size":4998,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/DSIW/sdf/pulls/52"},"html":{"href":"https://github.com/DSIW/sdf/pull/52"},"issue":{"href":"https://api.github.com/repos/DSIW/sdf/issues/52"},"comments":{"href":"https://api.github.com/repos/DSIW/sdf/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/DSIW/sdf/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/DSIW/sdf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DSIW/sdf/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/DSIW/sdf/statuses/e17eb77e203cfba9a1d173dbec7d979f10dc7687"}}}}