Commit 1d6278d523ab2d57a4373ca06ad9d7640767859d

Authored by Drew Baek ago
1 parent cac58ae918
Exists in master

add views for patch set build

Showing 10 changed files with 56 additions and 3 deletions Side-by-side Diff

distribute/admin.py View file @ 1d6278d
1 1 from distribute.models import ReleaseItem
  2 +from distribute.models import TestItem
2 3 from django.contrib import admin
3 4  
4 5  
5 6 class ReleaseItemAdmin(admin.ModelAdmin):
6 7 list_display = ('type', 'pub_date', 'app_version', 'is_publish')
7 8  
  9 +class TestItemAdmin(admin.ModelAdmin):
  10 + list_display = ('type', 'pub_date', 'app_version', 'is_publish')
  11 +
8 12 admin.site.register(ReleaseItem, ReleaseItemAdmin)
  13 +admin.site.register(TestItem, TestItemAdmin)
distribute/admin.pyc View file @ 1d6278d

No preview for this file type

distribute/models.py View file @ 1d6278d
... ... @@ -9,4 +9,13 @@
9 9 app_version = models.CharField(max_length=20)
10 10 is_publish = models.BooleanField(default=0)
11 11 comment = models.CharField(max_length=1000, default=None)
  12 +
  13 +
  14 +class TestItem(models.Model):
  15 + type = models.CharField(max_length=10)
  16 + pub_date = models.CharField(max_length=15)
  17 + last_commit = models.CharField(max_length=40)
  18 + app_version = models.CharField(max_length=20)
  19 + is_publish = models.BooleanField(default=0)
  20 + comment = models.CharField(max_length=1000, default=None)
distribute/models.pyc View file @ 1d6278d

No preview for this file type

distribute/views.py View file @ 1d6278d
1 1 from django.http import HttpResponse
2 2 from django.contrib.auth.decorators import login_required
3 3 from distribute.models import ReleaseItem
  4 +from distribute.models import TestItem
4 5 from django.shortcuts import render_to_response
5 6 from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
6 7 from django.contrib.auth import logout
... ... @@ -18,7 +19,7 @@
18 19 except EmptyPage:
19 20 # If page is out of range (e.g. 9999), deliver last page of results.
20 21 list = paginator.page(paginator.num_pages)
21   -
  22 +
22 23 return list
23 24  
24 25 @login_required(login_url='/accounts/login/')
... ... @@ -44,7 +45,7 @@
44 45 commit_id = request.GET.get('commit_id')
45 46 pub_date = request.GET.get('pub_date')
46 47 app_version = request.GET.get('app_version')
47   -
  48 +
48 49 if type != None and commit_id != None and pub_date != None and app_version != None:
49 50 newItem = ReleaseItem()
50 51 newItem.type=str(type)
... ... @@ -58,5 +59,40 @@
58 59  
59 60 def logout_view(request):
60 61 logout(request)
61   - return redirect("https://internal-release.pikicast.com")
  62 + return redirect("https://internal-release.pikicast.com")
  63 +
  64 +@login_required(login_url='/accounts/login/')
  65 +def patchset(request):
  66 + page = request.GET.get('page')
  67 + type = request.GET.get('type')
  68 + pub_date = request.GET.get('pub_date')
  69 + items = []
  70 + if pub_date != None:
  71 + items = TestItem.objects.filter(pub_date=str(pub_date))
  72 + list = getPagenatedList(items, page)
  73 + return render_to_response('distribute/item_patchset.html', {'items' : list})
  74 +
  75 + if type == 'ios' or type == 'android':
  76 + items = TestItem.objects.filter(type=str(type)).order_by('-pub_date')
  77 + else:
  78 + items = TestItem.objects.all().order_by('-pub_date')
  79 + list = getPagenatedList(items, page)
  80 + return render_to_response('distribute/index_patchset.html', {'items' : list})
  81 +
  82 +def put_patchset(request):
  83 + type = request.GET.get('type')
  84 + commit_id = request.GET.get('commit_id')
  85 + pub_date = request.GET.get('pub_date')
  86 + app_version = request.GET.get('app_version')
  87 +
  88 + if type != None and commit_id != None and pub_date != None and app_version != None:
  89 + newItem = TestItem()
  90 + newItem.type=str(type)
  91 + newItem.last_commit=str(commit_id)
  92 + newItem.pub_date=str(pub_date)
  93 + newItem.app_version=str(app_version)
  94 + newItem.comment=""
  95 + newItem.save()
  96 +
  97 + return HttpResponse(status=201)
distribute/views.pyc View file @ 1d6278d

No preview for this file type

releasesite/settings.py View file @ 1d6278d
1 1 # Django settings for releasesite project.
2 2  
3 3 import os.path
  4 +
4 5 BASE_PATH = os.path.dirname(__file__)
5 6 LOGIN_REDIRECT_URL = '/distribute/'
6 7  
releasesite/settings.pyc View file @ 1d6278d

No preview for this file type

releasesite/urls.py View file @ 1d6278d
... ... @@ -17,6 +17,8 @@
17 17 url(r'^admin/', include(admin.site.urls)),
18 18 url(r'^$', 'distribute.views.index'),
19 19 url(r'^put/', 'distribute.views.put'),
  20 + url(r'^patchset/', 'distribute.views.patchset'),
  21 + url(r'^put_patchset/', 'distribute.views.put_patchset'),
20 22 url(r'^accounts/login/$', 'django.contrib.auth.views.login'),
21 23 url(r'^accounts/logout/$', 'distribute.views.logout_view'),
22 24 #url(r'^$', include('django.contrib.flatpages.urls')),
releasesite/urls.pyc View file @ 1d6278d

No preview for this file type