diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-08-26 15:39:14 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-29 13:56:50 +0100 |
commit | 25a715a1191bae2ac20e598555f49203f59c88b0 (patch) | |
tree | 9de7bc08b839343f30fabc19a62a8ef34c3f046f /bitbake/lib/toaster/toastergui/views.py | |
parent | ee250eb7e4be2c2964bbeeada93dfff7b8d5e72f (diff) | |
download | poky-25a715a1191bae2ac20e598555f49203f59c88b0.tar.gz |
bitbake: toatergui: update pages to match project models
We update pages and queries to match the new project
models.
(Bitbake rev: 8f47ec259106da714260c7388cee75a6c1f4622d)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 5b2336509a..e68f8b002f 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -1772,7 +1772,7 @@ if toastermain.settings.MANAGED: | |||
1772 | from django.contrib.auth.decorators import login_required | 1772 | from django.contrib.auth.decorators import login_required |
1773 | 1773 | ||
1774 | from orm.models import Project, ProjectLayer, ProjectTarget, ProjectVariable | 1774 | from orm.models import Project, ProjectLayer, ProjectTarget, ProjectVariable |
1775 | from orm.models import Branch, LayerSource, ToasterSetting | 1775 | from orm.models import Branch, LayerSource, ToasterSetting, Release |
1776 | from bldcontrol.models import BuildRequest | 1776 | from bldcontrol.models import BuildRequest |
1777 | 1777 | ||
1778 | import traceback | 1778 | import traceback |
@@ -1792,7 +1792,7 @@ if toastermain.settings.MANAGED: | |||
1792 | context = { | 1792 | context = { |
1793 | 'email': request.user.email if request.user.is_authenticated() else '', | 1793 | 'email': request.user.email if request.user.is_authenticated() else '', |
1794 | 'username': request.user.username if request.user.is_authenticated() else '', | 1794 | 'username': request.user.username if request.user.is_authenticated() else '', |
1795 | 'branches': Branch.objects.order_by("-up_id"), | 1795 | 'releases': Release.objects.order_by("id"), |
1796 | 'defaultbranch': ToasterSetting.objects.get(name = "DEFAULT_RELEASE").value, | 1796 | 'defaultbranch': ToasterSetting.objects.get(name = "DEFAULT_RELEASE").value, |
1797 | } | 1797 | } |
1798 | 1798 | ||
@@ -1819,15 +1819,14 @@ if toastermain.settings.MANAGED: | |||
1819 | 1819 | ||
1820 | # save the project | 1820 | # save the project |
1821 | prj = Project.objects.create_project(name = request.POST['projectname'], | 1821 | prj = Project.objects.create_project(name = request.POST['projectname'], |
1822 | branch = Branch.objects.get(pk = request.POST['projectversion'].split(" ")[0]), | 1822 | release = Release.objects.get(pk = request.POST['projectversion'])) |
1823 | short_description=request.POST['projectversion'].split(" ")[1:]) | ||
1824 | prj.user_id = request.user.pk | 1823 | prj.user_id = request.user.pk |
1825 | prj.save() | 1824 | prj.save() |
1826 | return redirect(reverse(project, args = (prj.pk,))) | 1825 | return redirect(reverse(project, args = (prj.pk,))) |
1827 | 1826 | ||
1828 | except (IntegrityError, BadParameterException) as e: | 1827 | except (IntegrityError, BadParameterException) as e: |
1829 | # fill in page with previously submitted values | 1828 | # fill in page with previously submitted values |
1830 | map(lambda x: context.__setitem__(x, request.POST[x]), mandatory_fields) | 1829 | map(lambda x: context.__setitem__(x, request.POST.get(x, "-- missing")), mandatory_fields) |
1831 | if isinstance(e, IntegrityError) and "username" in str(e): | 1830 | if isinstance(e, IntegrityError) and "username" in str(e): |
1832 | context['alert'] = "Your chosen username is already used" | 1831 | context['alert'] = "Your chosen username is already used" |
1833 | else: | 1832 | else: |
@@ -1917,7 +1916,7 @@ if toastermain.settings.MANAGED: | |||
1917 | # return all project settings | 1916 | # return all project settings |
1918 | return HttpResponse(json.dumps( { | 1917 | return HttpResponse(json.dumps( { |
1919 | "error": "ok", | 1918 | "error": "ok", |
1920 | "layers": map(lambda x: (x.name, x.giturl), prj.projectlayer_set.all()), | 1919 | "layers": map(lambda x: (x.layercommit.layer.name, x.layercommit.layer.layer_index_url), prj.projectlayer_set.all()), |
1921 | "targets" : map(lambda x: {"target" : x.target, "task" : x.task, "pk": x.pk}, prj.projecttarget_set.all()), | 1920 | "targets" : map(lambda x: {"target" : x.target, "task" : x.task, "pk": x.pk}, prj.projecttarget_set.all()), |
1922 | "variables": map(lambda x: (x.name, x.value), prj.projectvariable_set.all()), | 1921 | "variables": map(lambda x: (x.name, x.value), prj.projectvariable_set.all()), |
1923 | }), content_type = "application/json") | 1922 | }), content_type = "application/json") |
@@ -1945,7 +1944,7 @@ if toastermain.settings.MANAGED: | |||
1945 | 1944 | ||
1946 | queryset_all = Layer_Version.objects.all() | 1945 | queryset_all = Layer_Version.objects.all() |
1947 | if 'project' in request.session: | 1946 | if 'project' in request.session: |
1948 | queryset_all = queryset_all.filter(up_branch = request.session['project'].branch) | 1947 | queryset_all = queryset_all.filter(up_branch__in = Branch.objects.filter(name = request.session['project'].release.name)) |
1949 | 1948 | ||
1950 | queryset_with_search = _get_queryset(Layer_Version, queryset_all, None, search_term, ordering_string, '-layer__name') | 1949 | queryset_with_search = _get_queryset(Layer_Version, queryset_all, None, search_term, ordering_string, '-layer__name') |
1951 | queryset = _get_queryset(Layer_Version, queryset_all, filter_string, search_term, ordering_string, '-layer__name') | 1950 | queryset = _get_queryset(Layer_Version, queryset_all, filter_string, search_term, ordering_string, '-layer__name') |