Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nk20
Manage
Activity
Members
Labels
Plan
Issues
31
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDE
nk20
Commits
bdb0f677
Commit
bdb0f677
authored
4 years ago
by
ynerant
Browse files
Options
Downloads
Patches
Plain Diff
List pre-registrations (TODO: filter)
parent
6b8e9d45
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!78
WEI
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
apps/wei/models.py
+2
-0
2 additions, 0 deletions
apps/wei/models.py
apps/wei/tables.py
+62
-2
62 additions, 2 deletions
apps/wei/tables.py
apps/wei/views.py
+23
-8
23 additions, 8 deletions
apps/wei/views.py
templates/wei/weiclub_tables.html
+32
-0
32 additions, 0 deletions
templates/wei/weiclub_tables.html
with
119 additions
and
10 deletions
apps/wei/models.py
+
2
−
0
View file @
bdb0f677
...
...
@@ -154,6 +154,8 @@ class WEIRegistration(models.Model):
)
health_issues
=
models
.
TextField
(
blank
=
True
,
default
=
""
,
verbose_name
=
_
(
"
health issues
"
),
)
...
...
This diff is collapsed.
Click to expand it.
apps/wei/tables.py
+
62
−
2
View file @
bdb0f677
...
...
@@ -3,13 +3,15 @@
import
django_tables2
as
tables
from
django.urls
import
reverse_lazy
from
django.utils.translation
import
gettext_lazy
as
_
from
django_tables2
import
A
from
.models
import
WEIClub
from
.models
import
WEIClub
,
WEIRegistration
class
WEITable
(
tables
.
Table
):
"""
List all
clubs
.
List all
WEI
.
"""
class
Meta
:
attrs
=
{
...
...
@@ -23,3 +25,61 @@ class WEITable(tables.Table):
'
id
'
:
lambda
record
:
"
row-
"
+
str
(
record
.
pk
),
'
data-href
'
:
lambda
record
:
reverse_lazy
(
'
wei:wei_detail
'
,
args
=
(
record
.
pk
,))
}
class
WEIRegistrationTable
(
tables
.
Table
):
"""
List all WEI registrations.
"""
user
=
tables
.
LinkColumn
(
'
member:user_detail
'
,
args
=
[
A
(
'
user.pk
'
)],
)
edit
=
tables
.
LinkColumn
(
'
wei:wei_detail
'
,
args
=
[
A
(
'
pk
'
)],
verbose_name
=
_
(
"
Edit
"
),
text
=
_
(
"
Edit
"
),
attrs
=
{
'
a
'
:
{
'
class
'
:
'
btn btn-warning
'
}
}
)
validate
=
tables
.
LinkColumn
(
'
wei:wei_detail
'
,
args
=
[
A
(
'
pk
'
)],
verbose_name
=
_
(
"
Validate
"
),
text
=
_
(
"
Validate
"
),
attrs
=
{
'
a
'
:
{
'
class
'
:
'
btn btn-success
'
}
}
)
delete
=
tables
.
LinkColumn
(
'
wei:wei_detail
'
,
args
=
[
A
(
'
pk
'
)],
verbose_name
=
_
(
"
delete
"
),
text
=
_
(
"
Delete
"
),
attrs
=
{
'
a
'
:
{
'
class
'
:
'
btn btn-danger
'
}
},
)
class
Meta
:
attrs
=
{
'
class
'
:
'
table table-condensed table-striped table-hover
'
}
model
=
WEIRegistration
template_name
=
'
django_tables2/bootstrap4.html
'
fields
=
(
'
user
'
,)
row_attrs
=
{
'
class
'
:
'
table-row
'
,
'
id
'
:
lambda
record
:
"
row-
"
+
str
(
record
.
pk
),
'
data-href
'
:
lambda
record
:
record
.
pk
}
This diff is collapsed.
Click to expand it.
apps/wei/views.py
+
23
−
8
View file @
bdb0f677
...
...
@@ -16,9 +16,9 @@ from note.tables import HistoryTable
from
permission.backends
import
PermissionBackend
from
permission.views
import
ProtectQuerysetMixin
from
.models
import
WEIClub
,
WEIRegistration
from
.models
import
WEIClub
,
WEIRegistration
,
WEIMembership
from
.forms
import
WEIForm
,
WEIRegistrationForm
from
.tables
import
WEITable
from
.tables
import
WEITable
,
WEIRegistrationTable
class
WEIListView
(
ProtectQuerysetMixin
,
LoginRequiredMixin
,
SingleTableView
):
...
...
@@ -67,15 +67,30 @@ class WEIDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
history_table
=
HistoryTable
(
club_transactions
,
prefix
=
"
history-
"
)
history_table
.
paginate
(
per_page
=
20
,
page
=
self
.
request
.
GET
.
get
(
'
history-page
'
,
1
))
context
[
'
history_list
'
]
=
history_table
club_member
=
Membership
.
objects
.
filter
(
club_member
=
WEIMembership
.
objects
.
filter
(
club
=
club
,
date_end__gte
=
datetime
.
today
(),
).
filter
(
PermissionBackend
.
filter_queryset
(
self
.
request
.
user
,
Membership
,
"
view
"
))
).
filter
(
PermissionBackend
.
filter_queryset
(
self
.
request
.
user
,
WEIMembership
,
"
view
"
))
membership_table
=
MembershipTable
(
data
=
club_member
,
prefix
=
"
membership-
"
)
membership_table
.
paginate
(
per_page
=
20
,
page
=
self
.
request
.
GET
.
get
(
'
membership-page
'
,
1
))
context
[
'
member_list
'
]
=
membership_table
WEIRegistrationTable
.
base_columns
[
"
delete
"
].
visible
=
False
WEIRegistrationTable
.
base_columns
[
"
validate
"
].
visible
=
False
all_registrations
=
WEIRegistration
.
objects
.
filter
(
PermissionBackend
.
filter_queryset
(
self
.
request
.
user
,
WEIRegistration
,
"
view
"
))
all_registrations_table
=
WEIRegistrationTable
(
data
=
all_registrations
,
prefix
=
"
all-registration-
"
)
all_registrations_table
.
paginate
(
per_page
=
20
,
page
=
self
.
request
.
GET
.
get
(
'
membership-page
'
,
1
))
context
[
'
all_registrations
'
]
=
all_registrations_table
WEIRegistrationTable
.
base_columns
[
"
delete
"
].
visible
=
True
WEIRegistrationTable
.
base_columns
[
"
validate
"
].
visible
=
True
pre_registrations
=
all_registrations
.
filter
(
membership
=
None
)
pre_registrations_table
=
WEIRegistrationTable
(
data
=
pre_registrations
,
prefix
=
"
pre-registration-
"
)
pre_registrations_table
.
paginate
(
per_page
=
20
,
page
=
self
.
request
.
GET
.
get
(
'
membership-page
'
,
1
))
context
[
'
pre_registrations
'
]
=
pre_registrations_table
# Check if the user has the right to create a membership, to display the button.
empty_membership
=
Membership
(
club
=
club
,
...
...
@@ -115,9 +130,9 @@ class WEIRegisterView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
return
form
def
form_valid
(
self
,
form
):
ret
=
super
().
form_valid
(
form
)
return
ret
form
.
instance
.
wei
=
WEIClub
.
objects
.
get
(
pk
=
self
.
kwargs
[
"
wei_pk
"
]
)
return
super
().
form_valid
(
form
)
def
get_success_url
(
self
):
self
.
object
.
refresh_from_db
()
return
reverse_lazy
(
"
wei:wei_detail
"
,
kwargs
=
{
"
pk
"
:
self
.
object
.
pk
})
return
reverse_lazy
(
"
wei:wei_detail
"
,
kwargs
=
{
"
pk
"
:
self
.
object
.
wei
.
pk
})
This diff is collapsed.
Click to expand it.
templates/wei/weiclub_tables.html
+
32
−
0
View file @
bdb0f677
...
...
@@ -57,6 +57,8 @@
</div>
</div>
<hr>
{% if member_list.data %}
<div
class=
"card"
>
<div
class=
"card-header position-relative"
id=
"clubListHeading"
>
...
...
@@ -81,4 +83,34 @@
{% render_table history_list %}
</div>
</div>
<hr>
{% endif %}
{% if pre_registrations.data %}
<div
class=
"card"
>
<div
class=
"card-header position-relative"
id=
"historyListHeading"
>
<a
class=
"btn btn-link stretched-link font-weight-bold"
>
<i
class=
"fa fa-user-plus"
></i>
{% trans "Unvalidated registrations" %}
</a>
</div>
<div
id=
"history_list"
>
{% render_table pre_registrations %}
</div>
</div>
<hr>
{% endif %}
{% if all_registrations.data or True %}
<div
class=
"card"
>
<div
class=
"card-header position-relative"
id=
"historyListHeading"
>
<a
class=
"btn btn-link stretched-link font-weight-bold"
>
<i
class=
"fa fa-user-plus"
></i>
{% trans "All registrations" %}
</a>
</div>
<div
id=
"history_list"
>
{% render_table all_registrations %}
</div>
</div>
{% endif %}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment