Commit 15dd260e authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Merge branch 'url-fixes' into 'django'

Various url fixes

Closes #261 and #249

See merge request !127
parents 7a793b87 e343eeb6
Pipeline #40336 failed with stage
in 1 minute and 18 seconds
......@@ -188,7 +188,8 @@ class Webapp(TimeStampModel):
docker_name_validator,
# 'root' and 'sshd' are reserved because webapp docker_names are mapped
# to system users inside the ssh container
RegexValidator(r"\A(root|sshd)\Z", inverse_match=True,
# '_.*' is reserved because of url conflicts
RegexValidator(r"\A(root\Z|sshd\Z|_)", inverse_match=True,
message="This is a reserved name"),
])
readme = models.IntegerField(blank=True, null=True)
......
......@@ -47,34 +47,38 @@ app_name = 'main'
urlpatterns = [
url(r'^$', views.IndexDetail.as_view(), name="home"),
url(r'^apps/$', views.WebappList.as_view(), name='webapp_list'),
url(r'^apps/authors/(?P<username>[\w.@+-]+)/$', views.UserWebappList.as_view(), name='user_webapp_list'),
url(r'^apps/(?P<docker_name>[\w-]+)/update/$', views.WebappUpdate.as_view(), name="webapp_update"),
url(r'^apps/create/$', views.WebappCreate.as_view(), name='webapp_creation'),
url(r'^apps/(?P<docker_name>[\w-]+)/sandbox/$', views.WebappSandboxPanel.as_view(), name="webapp_sandbox_panel"),
url(r'^apps/_authors/(?P<username>[\w.@+-]+)/$', views.UserWebappList.as_view(), name='user_webapp_list'),
url(r'^apps/_create/$', views.WebappCreate.as_view(), name='webapp_creation'),
url(r'^apps/(?P<docker_name>[\w-]+)/update$', views.WebappUpdate.as_view(), name="webapp_update"),
url(r'^apps/(?P<docker_name>[\w-]+)/sandbox$', views.WebappSandboxPanel.as_view(), name="webapp_sandbox_panel"),
url(r'^apps/(?P<docker_name>[\w-]+)/json$', views.WebappJson.as_view(), name='webapp_json'),
url(r'^app/(?P<docker_name>[\w-]+)/$', views.JobCreate.as_view(), name='webapp_detail'),
url(r'^apps/(?P<docker_name>[\w-]+)$', views.JobCreate.as_view(), name='webapp_detail'),
url(r'^tags/$', views.TagList.as_view(), name='tag_list'),
url(r'^tags/(?P<slug>[\w-]+)/$', views.TagWebappList.as_view(), name='tag_webapp_list'),
url(r'^tags/(?P<slug>[\w-]+)$', views.TagWebappList.as_view(), name='tag_webapp_list'),
url(r'^jobs/$', views.JobList.as_view(), name='job_list'),
url(r'^jobs/(?P<pk>\d+)/$', views.JobDetail.as_view(), name='job_detail'),
url(r'^jobs/delete/(?P<pk>\d+)/$', views.JobDelete.as_view(), name='job_delete'),
url(r'^jobs/abort/(?P<pk>\d+)/$', views.JobAbort.as_view(), name='job_abort'),
url(r'^jobs/(?P<pk>\d+)$', views.JobDetail.as_view(), name='job_detail'),
url(r'^jobs/(?P<pk>\d+)/abort$', views.JobAbort.as_view(), name='job_abort'),
url(r'^jobs/(?P<pk>\d+)/delete$', views.JobDelete.as_view(), name='job_delete'),
url(r'^jobs/(?P<pk>\d+)/archive$', views.JobFileDownloadAll.as_view(), name='job_download_all'),
url(r'^jobs/(?P<pk>\d+)/download/(?P<filename>(.*))$', views.JobFileDownload.as_view(), name='job_download_file'),
url(r'^profile/$', views.UserUpdate.as_view(), name='user_detail'),
url(r'^profile$', views.UserUpdate.as_view(), name='user_detail'),
url(r'^profile/token/update$', views.UserToken.as_view(), name='user_token'),
url(r'^profile/ssh/add/$', views.UserSSHAdd.as_view(), name='user_ssh_add'),
url(r'^profile/ssh/delete/$', views.UserSSHDelete.as_view(), name='user_ssh_delete'),
url(r'^profile/ssh/add$', views.UserSSHAdd.as_view(), name='user_ssh_add'),
url(r'^profile/ssh/delete$', views.UserSSHDelete.as_view(), name='user_ssh_delete'),
url(r'^profile/password$', views.UserPasswordUpdate.as_view(), name='user_password'),
# url(r'^runners/$', views.RunnerList.as_view(), name='runner_list'),
# url(r'^runners/add/$', views.RunnerCreate.as_view(), name='runner_create'),
# url(r'^runners/(?P<pk>\d+)/update/$', views.RunnerUpdate.as_view(), name='runner_update'),
# url(r'^runners/(?P<pk>\d+)/delete/$', views.RunnerDelete.as_view(), name='runner_delete'),
# url(r'^runners/_add$', views.RunnerCreate.as_view(), name='runner_create'),
# url(r'^runners/(?P<pk>\d+)/update$', views.RunnerUpdate.as_view(), name='runner_update'),
# url(r'^runners/(?P<pk>\d+)/delete$', views.RunnerDelete.as_view(), name='runner_delete'),
url(r'^auth$', views.auth, name="auth"),
# important legacy URLs (from the rails implementation)
url(r'^webapps/(?P<pk>\d+)/?$', views.LegacyWebappDetail.as_view()),
url(r'^app/(?P<slug>[\w-]+)/?$', views.LegacyWebappDetail.as_view()),
]
......@@ -114,6 +114,15 @@ class IndexDetail(TemplateView):
return context
# Legacy views
class LegacyWebappDetail(SingleObjectMixin, RedirectView):
model = Webapp
permanent = True
slug_field = "docker_name"
def get_redirect_url(self, **kwargs):
return reverse("main:webapp_detail",
args=(self.get_object().docker_name,))
# WEBAPPS
# -----------------------------------------------------------------------------
class WebappList(ListView):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment