Commit cac58ae918f5934390279b52fb02507c3e2b42a5

Authored by Drew Baek ago
1 parent dec9b5ef5d
Exists in master

Add logout view

Showing 4 changed files with 9 additions and 4 deletions Side-by-side Diff

distribute/views.py View file @ cac58ae
... ... @@ -3,6 +3,8 @@
3 3 from distribute.models import ReleaseItem
4 4 from django.shortcuts import render_to_response
5 5 from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
  6 +from django.contrib.auth import logout
  7 +from django.shortcuts import redirect
6 8  
7 9 PAGE = 5
8 10  
... ... @@ -16,7 +18,7 @@
16 18 except EmptyPage:
17 19 # If page is out of range (e.g. 9999), deliver last page of results.
18 20 list = paginator.page(paginator.num_pages)
19   -
  21 +
20 22 return list
21 23  
22 24 @login_required(login_url='/accounts/login/')
... ... @@ -42,7 +44,7 @@
42 44 commit_id = request.GET.get('commit_id')
43 45 pub_date = request.GET.get('pub_date')
44 46 app_version = request.GET.get('app_version')
45   -
  47 +
46 48 if type != None and commit_id != None and pub_date != None and app_version != None:
47 49 newItem = ReleaseItem()
48 50 newItem.type=str(type)
... ... @@ -53,5 +55,8 @@
53 55 newItem.save()
54 56  
55 57 return HttpResponse(status=201)
56   - #return HttpResponse("%s %s %s %s" % (type,commit_id,pub_date,app_version))
  58 +
  59 +def logout_view(request):
  60 + logout(request)
  61 + return redirect("https://internal-release.pikicast.com")
distribute/views.pyc View file @ cac58ae

No preview for this file type

releasesite/urls.py View file @ cac58ae
... ... @@ -18,7 +18,7 @@
18 18 url(r'^$', 'distribute.views.index'),
19 19 url(r'^put/', 'distribute.views.put'),
20 20 url(r'^accounts/login/$', 'django.contrib.auth.views.login'),
21   - url(r'^accounts/logout/$', 'django.contrib.auth.views.logout'),
  21 + url(r'^accounts/logout/$', 'distribute.views.logout_view'),
22 22 #url(r'^$', include('django.contrib.flatpages.urls')),
23 23 #url(r'^distribute/', include('django_mobile_app_distribution.urls')),
24 24 #url(r'^accounts/', include('django_mobile_app_distribution.auth_urls')),
releasesite/urls.pyc View file @ cac58ae

No preview for this file type