def test_project_view_returns(self): slug = self.valid_project.slug pk = self.valid_project.pk request = self.factory.get( reverse('project_detail', kwargs={'slug': slug})) request.user = self.staff_user response = ProjectDetailView.as_view()(request, pk=pk) self.assertEqual(response.status_code, 200)
def test_project_view_renders_assetgroup_list(self): slug = self.valid_project.slug pk = self.valid_project.pk request = self.factory.get( reverse('project_detail', kwargs={'slug': slug})) request.user = self.staff_user response = ProjectDetailView.as_view()(request, pk=pk) self.assertEqual(response.context_data['assetgroup_list'][0], self.assetgroup_list[0])
def test_project_view_renders_template(self): slug = self.valid_project.slug pk = self.valid_project.pk request = self.factory.get( reverse('project_detail', kwargs={'slug': slug})) request.user = self.staff_user response = ProjectDetailView.as_view()(request, pk=pk) self.assertEqual(response.template_name[0], 'projects/project_detail.html')
def test_item_from_artifact_and_archived_artifact(self): """ Return an artifact or archived artifact in a standard format for display. """ project = ProjectFactory.create() dependency = DependencyFactory.create() ProjectDependency.objects.create(project=project, dependency=dependency) projectbuild = build_project(project, queue_build=False) build = BuildFactory.create( job=dependency.job, build_id=projectbuild.build_key, phase=Build.FINALIZED) # Create the artifact and check the display format artifact = ArtifactFactory.create(build=build, filename="file1.gz") artifact_item = ProjectDetailView.item_from_artifact(artifact) self.assertIsNotNone(artifact_item) self.assertTrue(isinstance(artifact_item, dict)) self.assertTrue("build_name" in artifact_item) self.assertTrue("filename" in artifact_item) self.assertTrue("url" in artifact_item) self.assertTrue("archived" in artifact_item) # Archive the artifact and check the display format process_build_dependencies(build.pk) archive = ArchiveFactory.create(policy="cdimage", default=True) items = [] for x in archive.add_build(build)[artifact]: if x.projectbuild_dependency: items.append(x) self.assertEquals(len(items), 1) archived_item = ProjectDetailView.item_from_archived_artifact(items[0]) self.assertIsNotNone(archived_item) self.assertTrue(isinstance(archived_item, dict)) self.assertTrue("build_name" in archived_item) self.assertTrue("filename" in archived_item) self.assertTrue("url" in archived_item) self.assertTrue("archived" in archived_item)
def test_project_detail_artifacts(self): """ The project detail should return artifacts with the URL from Jenkins or from the archive (for archived artifacts). """ project = ProjectFactory.create() dependency = DependencyFactory.create() ProjectDependency.objects.create(project=project, dependency=dependency) projectbuild = build_project(project, queue_build=False) build = BuildFactory.create( job=dependency.job, build_id=projectbuild.build_key, phase=Build.FINALIZED) artifact = ArtifactFactory.create(build=build, filename="file1.gz") process_build_dependencies(build.pk) # The project detail should link to the artifact from Jenkins project_url = reverse("project_detail", kwargs={"pk": project.pk}) response = self.app.get(project_url, user="******") self.assertEqual(200, response.status_code) self.assertIsNotNone( response.context["project"].get_current_projectbuild()) self.assertEqual( [ProjectDetailView.item_from_artifact(artifact)], response.context["current_artifacts"]) # Archive the artifact and the view should display the archived item archive = ArchiveFactory.create(policy="cdimage", default=True) items = [] for x in archive.add_build(build)[artifact]: if x.projectbuild_dependency: items.append(ProjectDetailView.item_from_archived_artifact(x)) project_url = reverse("project_detail", kwargs={"pk": project.pk}) response = self.app.get(project_url, user="******") self.assertEqual(200, response.status_code) self.assertEqual(items, response.context["current_artifacts"])
from django.conf.urls import patterns, url from projects.views import ProjectDetailView urlpatterns = patterns( '', url(regex=r'^(?P<slug>[-\w]+)/$', view=ProjectDetailView.as_view(), name='project_detail'), )
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from django.conf import settings from django.conf.urls.static import static from projects import views as projects_views from projects.views import ProjectDetailView urlpatterns = [ path('', projects_views.presentation), path('admin/', admin.site.urls), path('projects/', projects_views.list_projects), path('projects/<int:pk>', ProjectDetailView.as_view()) ] if settings.DEBUG is True: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# Examples: url(r'^grappelli/', include('grappelli.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^$', IndexView.as_view(), name='home'), url(r'links/$', RedirectView.as_view(url=reverse_lazy('links-index', args=[1])) ), url(r'links/(?P<page>[0-9]+)/$', LinksIndexView.as_view(), name='links-index'), url(r'posts/$', RedirectView.as_view(url=reverse_lazy('all-index', args=[1])) ), url(r'posts/all/(?P<page>[0-9]+)/$', AllBlogListView.as_view(), name='all-index'), url(r'posts/blog/(?P<page>[0-9]+)/$', BlogBlogListView.as_view(), name='blog-index'), url(r'posts/post/(?P<slug>[a-zA-Z0-9-_]+)/$', BlogDetailView.as_view(), name='blog-entry'), url(r'software/$', RedirectView.as_view(url=reverse_lazy('software-index', args=[1])) ), url(r'posts/software/(?P<page>[0-9]+)/$', SoftwareBlogListView.as_view(), name='software-index'), url(r'reviews/$', RedirectView.as_view(url=reverse_lazy('review-index', args=[1])) ), url(r'posts/reviews/(?P<page>[0-9]+)/$', ReviewBlogListView.as_view(), name='reviews-index'), url(r'projects/$', RedirectView.as_view(url=reverse_lazy('project-index', args=[1])), name='projects' ), url(r'projects/(?P<page>[0-9]+)/$', ProjectListView.as_view(), name='project-index'), url(r'projects/(?P<slug>[a-zA-Z0-9-_]+)/$', ProjectDetailView.as_view(), name='project'), url(r'gallery/(?P<slug>[a-zA-Z0-9-_]+)/$', GalleryDetailView.as_view(), name='gallery'), #url(r'^$', 'letts_me.views.home', name='home'), # url(r'^blog/', include('blog.urls')), # Historic redirects url(r'blog/$', RedirectView.as_view(url=reverse_lazy('blog-index', args=[1])) ), url(r'blog/(?P<slug>[a-zA-Z0-9-_]+)/$', BlogDetailView.as_view(), name='blog-entry'), ) if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root = settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
from django.conf.urls import patterns, url from projects.views import ProjectListView, ProjectDetailView, ProjectTagListView, ProjectLanguageListView urlpatterns = patterns('projects.views', url(r'^$', ProjectListView.as_view(), name="projects_index"), url(r'p/(?P<pk>\d+)/$', ProjectDetailView.as_view(), name="project_root"), url(r'^tag/(?P<pk>\d+)/$', ProjectTagListView.as_view(), name="project_tag"), url(r'^lang/(?P<pk>\d+)/', ProjectLanguageListView.as_view(), name="project_language") )
# -*- coding: utf-8 -*- from django.conf.urls import url from projects.views import ProjectsListView, ProjectDetailView, JoinProjectView, label_next_image, labels, label_view from images.views import ImageLabelUpdateView urlpatterns = [ url(r'^$', ProjectsListView.as_view(), name='projects-list'), url(r'^(?P<slug>[-\w]+)/?$', ProjectDetailView.as_view(), name='porject-detail'), url(r'^(?P<slug>[-\w]+)/join/?$', JoinProjectView.as_view(), name='join-project'), url(r'^[-\w]+/image/(?P<pk>[0-9]+)/?$', ImageLabelUpdateView.as_view(), name='image-label-update'), url(r'^(?P<slug>[-\w]+)/next/$', label_next_image, name='label-next-image'), url(r'^(?P<slug>[-\w]+)/labels/$', labels, name='labels'), url(r'^label/(?P<labelid>[0-9]+)/$', label_view, name='label-view') ]
from django.conf.urls import url from projects.views import ProjectListView, ProjectDetailView, ProjectTaskListView, ProjectTaskDetailView __author__ = 'Aleh' urlpatterns = [ url(r'^$', ProjectListView.as_view(), name='project_list'), url(r'^(?P<pk>[\d]+)/$', ProjectDetailView.as_view(), name='project_detail'), url(r'^(?P<pk>[\d]+)/task/$', ProjectTaskListView.as_view(), name='project_task_list'), url(r'^(?P<pk>[\d]+)/task/(?P<task_pk>[\d]+)/$', ProjectTaskDetailView.as_view(), name='project_task_detail') ]
from django.conf.urls import url from django.contrib.auth.decorators import permission_required, login_required from django.views.generic import DetailView, ListView, UpdateView, CreateView, DeleteView from projects.models import Project, Deliverable, DeliverableVolume from projects.views import ProjectListView, FilteredProjectListView, ProjectDetailView, ProjectUpdateView, ProjectCreateView, ProjectDeleteView from projects.views import DeliverableListView, DeliverableDetailView, DeliverableUpdateView, DeliverableCreateView, DeliverableDeleteView, AddDeliverableFromProjectView from projects.views import AddDeliverableVolumeView, DeliverableVolumeUpdateView from qualifications.views import AddPositionFromProjectView urlpatterns = [ ################################## # Projects url(r'^projects/$', ProjectListView.as_view(), name='projects_list'), url(r'^projects/(?P<pk>\d+)/$', ProjectDetailView.as_view(), name='project_detail'), url(r'^projects/create/$', ProjectCreateView.as_view(), name='create_project'), url(r'^projects/(?P<pk>\d+)/update/$', ProjectUpdateView.as_view(), name='update_project'), url(r'^projects/(?P<pk>\d+)/delete/$', ProjectDeleteView.as_view(), name='delete_project'), # Add deliverable to a project url(r'^projects/(?P<pk>\d+)/add_deliverable/$', AddDeliverableFromProjectView.as_view(), name='add_deliverable'), # Add position to a project url(r'^projects/(?P<pk>\d+)/add_position/$', AddPositionFromProjectView.as_view(), name='add_projectposition'), url(r'^projects/(?P<filter>.+)/$', FilteredProjectListView.as_view(),name='projects_list_status'), ################################## ################################## # Deliverables url(r'^deliverables/$', DeliverableListView.as_view(), name='deliverables_list' ),
from django.conf.urls import include, url from django.contrib.auth.decorators import login_required from projects.views import ProjectListView from projects.views import ProjectDetailView from projects.views import ProjectEditView from projects.views import ProjectCreateView from projects.views import ReferenceDetailView from projects.views import ReferenceEditView from projects.views import ReferenceCreateView from projects.views import AllocationRequestDetailView from projects.views import AllocationRequestCreateView urlpatterns = [ url(r'^list$', login_required(ProjectListView.as_view()), name='project-list'), url(r'^list/(?P<pk>[-\w]+)/$', login_required(ProjectDetailView.as_view()), name='project-detail'), url(r'^list/(?P<pk>[-\w]+)/edit$', login_required(ProjectEditView.as_view()), name='project-edit'), url(r'^create$', login_required(ProjectCreateView.as_view()), name='project-create'), url(r'^list/(?P<project_pk>[-\w]+)/references/(?P<pk>[-\w]+)/$', login_required(ReferenceDetailView.as_view()), name='reference-detail'), url(r'^list/(?P<project_pk>[-\w]+)/references/(?P<pk>[-\w]+)/edit$', login_required(ReferenceEditView.as_view()), name='reference-edit'), url(r'^list/(?P<project_pk>[-\w]+)/references/create$', login_required(ReferenceCreateView.as_view()), name='reference-create'), url(r'^list/(?P<project_pk>[-\w]+)/allocationrequests/(?P<pk>[-\w]+)/$', login_required(AllocationRequestDetailView.as_view()), name='allocation-request-detail'), url(r'^list/(?P<project_pk>[-\w]+)/allocationrequests/create$', login_required(AllocationRequestCreateView.as_view()), name='allocation-request-create'), ]
from django.conf.urls import url from projects.views import (ProjectListView, ProjectCreate, ProjectDetailView, ProjectUpdate) urlpatterns = [ url(r'^$', ProjectListView.as_view(), name='project_list'), url(r'^details/(?P<pk>\d+)/update/$', ProjectUpdate.as_view(), name='project_update'), url(r'^details/(?P<pk>\d+)/$', ProjectDetailView.as_view(), name='project_details'), url(r'^create/$', ProjectCreate.as_view(), name='project_create') ]
from django.conf.urls import patterns, include, url from django.conf import settings from projects.views import ProjectCreateView, ProjectDeleteView, \ ProjectUpdateView, ProjectDetailView, ProjectListView, \ ProjectConfirmView, QRCodeDetailView urlpatterns = patterns( '', url(r'^$', ProjectListView.as_view(), name='project_list'), url(r'^create/$', ProjectCreateView.as_view(), name='project_create'), url(r'^(?P<pk>\d+)/delete/$', ProjectDeleteView.as_view(), name='project_delete'), url(r'^(?P<pk>\d+)/update/$', ProjectUpdateView.as_view(), name='project_update'), url(r'^(?P<pk>\d+)/$', ProjectDetailView.as_view(), name='project_detail'), url(r'^confirm/$', ProjectConfirmView.as_view(), name='project_confirm'), url(r'^confirm/(?P<pk>\d+)/qrcode/$', QRCodeDetailView.as_view(), name="qrcode_detail") )
from projects.views import ProjectCreationView, ProjectCreatedView, ProjectUpdateView, \ ProjectUpdatedView, ProjectDetailView, HelpOfferSentView, \ ProjectListView, HelpOfferListView, NotificationDetailView, \ NotificationsListView from django.conf.urls import patterns, url urlpatterns = patterns('', url(r'^create-new-project/$', view=ProjectCreationView.as_view(), name='create-new-project'), url(r'^project-created/$', view=ProjectCreatedView.as_view(), name='project-created'), url(r'^update-project-details/(?P<pk>\d+)/$', view=ProjectUpdateView.as_view(), name='update-project-details'), url(r'^project-updated/$', view=ProjectUpdatedView.as_view(), name='project-updated'), url(r'^project-details/(?P<pk>\d+)/$', view=ProjectDetailView.as_view(), name='project-details'), url(r'^help-offer-sent/$', view=HelpOfferSentView.as_view(), name='help-offer-sent'), url(r'^my-projects/(?P<pk>\d+)/$', view=ProjectListView.as_view(), name='my-projects'), url(r'^my-help-offers/(?P<pk>\d+)/$', view=HelpOfferListView.as_view(), name='my-help-offers'), url(r'^notification-details/(?P<pk>\d+)/(?P<noti>\d+)/$', view=NotificationDetailView.as_view(), name='notification-details'), url(r'^respond-to-help-offer/(?P<pk>\d+)/(?P<status>\w+)/$', 'projects.views.respond_to_help_offer', name='respond-to-help-offer'), url(r'^my-notifications/(?P<pk>\d+)/$', view=NotificationsListView.as_view(), name='my-notifications'), url(r'^get-notifications/(?P<param>\w+)/$', 'projects.views.get_notifications', name='get-notifications'),
from django.urls import path from projects.views import ( UserProjectListView, ClosedProjectListView, MemberProjectListView, MemberClosedProjectListView, ProjectDetailView ) urlpatterns = [ path('', UserProjectListView.as_view(), name='project-list'), path('closed/', ClosedProjectListView.as_view(), name='closed-projects-list'), path('member/', MemberProjectListView.as_view(), name='member-projects-list'), path('member-closed/', MemberClosedProjectListView.as_view(), name='member-closed-projects-list'), path('<int:pk>/', ProjectDetailView.as_view(), name='project-detail'), ]
path('category/<slug>/', CategorySearchView.as_view(), name='category-search'), path('email-signup/', email_list_signup, name='email-list-signup'), # path('create/', post_create, name='post-create'), path('create/', PostCreateView.as_view(), name='post-create'), # path('post/<id>/', post_detail, name='post-detail'), path('post/<slug>/', PostDetailView.as_view(), name='post-detail'), # path('post/<id>/update/', post_update, name='post-update'), path('post/<slug>/update/', PostUpdateView.as_view(), name='post-update'), # path('post/<id>/delete/', post_delete, name='post-delete'), path('post/<slug>/delete/', PostDeleteView.as_view(), name='post-delete'), path('tinymce/', include('tinymce.urls')), path('accounts/', include('allauth.urls')), path('projects/', ProjectListView.as_view(), name='project-list'), path('project/<slug>/', ProjectDetailView.as_view(), name='project-detail'), path('project/<slug>/update/', ProjectUpdateView.as_view(), name='project-update'), path('project/<slug>/delete/', ProjectDeleteView.as_view(), name='project-delete'), path('resume/', resume, name='resume'), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)