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
d4af4bc9
Commit
d4af4bc9
authored
Feb 16, 2018
by
Guilhem Saurel
Browse files
ContributorsView
parent
6ef5b155
Changes
7
Hide whitespace changes
Inline
Side-by-side
rainboard/filters.py
View file @
d4af4bc9
import
django_filters
from
.
models
import
Project
from
.
import
models
class
ProjectFilter
(
django_filters
.
FilterSet
):
name
=
django_filters
.
CharFilter
(
lookup_expr
=
'icontains'
)
class
Meta
:
model
=
Project
model
=
models
.
Project
fields
=
(
'name'
,)
class
ContributorFilter
(
django_filters
.
FilterSet
):
name
=
django_filters
.
CharFilter
(
name
=
'contributorname__name'
,
label
=
'name'
,
lookup_expr
=
'icontains'
)
mail
=
django_filters
.
CharFilter
(
name
=
'contributormail__mail'
,
label
=
'mail'
,
lookup_expr
=
'icontains'
)
project
=
django_filters
.
CharFilter
(
name
=
'projects__name'
,
label
=
'project'
,
lookup_expr
=
'icontains'
)
class
Meta
:
model
=
models
.
Contributor
fields
=
(
'name'
,
'mail'
,
'project'
)
rainboard/tables.py
View file @
d4af4bc9
...
...
@@ -102,3 +102,10 @@ class ContributorTable(StrippedTable):
class
Meta
:
model
=
models
.
Contributor
fields
=
(
'names'
,
'mails'
)
class
ContributorProjectTable
(
ContributorTable
):
projects
=
tables
.
Column
(
accessor
=
'contributed'
,
orderable
=
False
)
class
Meta
:
fields
=
(
'names'
,
'mails'
,
'projects'
)
rainboard/templates/base.html
View file @
d4af4bc9
...
...
@@ -6,4 +6,5 @@
<li><a
href=
"{% url 'rainboard:articles' %}"
>
Articles
</a></li>
<li><a
href=
"{% url 'rainboard:forges' %}"
>
Forges
</a></li>
<li><a
href=
"{% url 'rainboard:namespaces' %}"
>
Namespaces
</a></li>
<li><a
href=
"{% url 'rainboard:contributors' %}"
>
Contributors
</a></li>
{% endblock %}
rainboard/templates/rainboard/contributor_filter.html
0 → 100644
View file @
d4af4bc9
{% extends 'base.html' %}
{% load django_tables2 bootstrap3 %}
{% block content %}
<h1>
Contributors
</h1>
{% if filter %}
<form
action=
""
method=
"get"
class=
"form form-inline"
>
{% bootstrap_form filter.form layout='inline' %}
{% bootstrap_button 'filter' %}
</form>
{% endif %}
{% render_table table %}
{% endblock %}
rainboard/templates/rainboard/project_filter.html
View file @
d4af4bc9
...
...
@@ -4,13 +4,14 @@
{% block content %}
<h1>
Projects
</h1>
{% if filter %}
<form
action=
""
method=
"get"
class=
"form form-inline"
>
{% bootstrap_form filter.form layout='inline' %}
{% bootstrap_button 'filter' %}
</form>
{% endif %}
{% render_table table %}
{% render_table table %}
{% endblock %}
rainboard/urls.py
View file @
d4af4bc9
...
...
@@ -10,6 +10,7 @@ urlpatterns = [
path
(
'articles'
,
views
.
ArticlesView
.
as_view
(),
name
=
'articles'
),
path
(
'article/create'
,
views
.
ArticleCreateView
.
as_view
(),
name
=
'article-new'
),
path
(
'namespaces'
,
views
.
NamespacesView
.
as_view
(),
name
=
'namespaces'
),
path
(
'contributors'
,
views
.
ContributorsView
.
as_view
(),
name
=
'contributors'
),
path
(
'projects'
,
views
.
ProjectsView
.
as_view
(),
name
=
'projects'
),
path
(
'project/<str:slug>/robotpkg'
,
views
.
ProjectView
.
as_view
(),
name
=
'project'
),
path
(
'project/<str:slug>/repos'
,
views
.
ProjectReposView
.
as_view
(),
name
=
'project-repos'
),
...
...
rainboard/views.py
View file @
d4af4bc9
...
...
@@ -4,8 +4,7 @@ from django_filters.views import FilterView
from
django_tables2
import
RequestConfig
from
django_tables2.views
import
SingleTableMixin
,
SingleTableView
from
.
import
models
,
tables
from
.filters
import
ProjectFilter
from
.
import
models
,
tables
,
filters
class
ArticlesView
(
SingleTableView
):
...
...
@@ -31,7 +30,7 @@ class NamespacesView(SingleTableView):
class
ProjectsView
(
SingleTableMixin
,
FilterView
):
model
=
models
.
Project
table_class
=
tables
.
ProjectTable
filterset_class
=
ProjectFilter
filterset_class
=
filters
.
ProjectFilter
class
ProjectView
(
DetailView
):
...
...
@@ -78,3 +77,9 @@ class ProjectContributorsView(ProjectTableView):
def
get_object_list
(
self
):
return
self
.
object
.
contributors
()
class
ContributorsView
(
SingleTableMixin
,
FilterView
):
model
=
models
.
Contributor
table_class
=
tables
.
ContributorProjectTable
filterset_class
=
filters
.
ContributorFilter
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