Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
dashboard
Commits
547e63aa
Commit
547e63aa
authored
Apr 06, 2018
by
Guilhem Saurel
Browse files
keep_doc
parent
3c96822c
Pipeline
#505
passed with stages
in 54 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
547e63aa
...
...
@@ -33,3 +33,4 @@ echo TRAVIS_TOKEN=xxx >> .env
## TODO
-
fix urls (https://api.github.com/repos/stack-of-tasks/pinocchio)
-
./bootstrap in robotpkg for
`make show-var VARNAME=…`
rainboard/migrations/0009_branch_keep_doc.py
0 → 100644
View file @
547e63aa
# Generated by Django 2.0.4 on 2018-04-06 14:19
from
django.db
import
migrations
,
models
from
django.db.models
import
F
,
Q
from
rainboard.utils
import
SOURCES
def
keep_doc
(
apps
,
schema_editor
):
apps
.
get_model
(
'rainboard'
,
'Branch'
).
objects
.
filter
(
Q
(
name__endswith
=
'master'
)
|
Q
(
name__endswith
=
'devel'
),
repo__namespace
=
F
(
'project__main_namespace'
),
repo__forge__source
=
SOURCES
.
gitlab
,
).
update
(
keep_doc
=
True
)
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'rainboard'
,
'0008_remove_article'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'branch'
,
name
=
'keep_doc'
,
field
=
models
.
BooleanField
(
default
=
False
),
),
migrations
.
RunPython
(
keep_doc
),
]
rainboard/models.py
View file @
547e63aa
...
...
@@ -438,6 +438,7 @@ class Branch(TimeStampedModel):
updated
=
models
.
DateTimeField
(
blank
=
True
,
null
=
True
)
repo
=
models
.
ForeignKey
(
Repo
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
deleted
=
models
.
BooleanField
(
default
=
False
)
keep_doc
=
models
.
BooleanField
(
default
=
False
)
def
__str__
(
self
):
return
self
.
name
...
...
rainboard/urls.py
View file @
547e63aa
...
...
@@ -16,4 +16,5 @@ urlpatterns = [
path
(
'project/<str:slug>/images'
,
views
.
ProjectImagesView
.
as_view
(),
name
=
'project-images'
),
path
(
'project/<str:slug>/contributors'
,
views
.
ProjectContributorsView
.
as_view
(),
name
=
'project-contributors'
),
path
(
'project/<str:slug>/gitlab-ci.yml'
,
views
.
ProjectGitlabView
.
as_view
(),
name
=
'project-gitlab'
),
path
(
'doc'
,
views
.
json_doc
,
name
=
'doc'
),
]
rainboard/views.py
View file @
547e63aa
from
django.http.response
import
JsonResponse
from
django.views.generic
import
DetailView
from
django_filters.views
import
FilterView
...
...
@@ -83,3 +84,11 @@ class ContributorsView(SingleTableMixin, DistinctMixin, FilterView):
model
=
models
.
Contributor
table_class
=
tables
.
ContributorProjectTable
filterset_class
=
filters
.
ContributorFilter
def
json_doc
(
request
):
"""
Get the list of project / namespace / branch of which we want to keep the doc
"""
return
JsonResponse
({
'ret'
:
[(
b
.
project
.
slug
,
b
.
repo
.
namespace
.
slug
,
b
.
name
.
split
(
'/'
,
maxsplit
=
2
)[
2
])
for
b
in
models
.
Branch
.
objects
.
filter
(
keep_doc
=
True
)]})
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment