Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
114272df
Commit
114272df
authored
Nov 25, 2016
by
Skia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add simple club stats
parent
c48449cd
Pipeline
#675
passed with stage
in 3 minutes and 22 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
16 deletions
+77
-16
club/templates/club/stats.jinja
club/templates/club/stats.jinja
+49
-0
club/urls.py
club/urls.py
+1
-0
club/views.py
club/views.py
+9
-1
core/models.py
core/models.py
+2
-15
sith/settings.py
sith/settings.py
+16
-0
No files found.
club/templates/club/stats.jinja
0 → 100644
View file @
114272df
{%
extends
"core/base.jinja"
%}
{%
block
title
%}
{%
trans
%}
Club stats
{%
endtrans
%}
{%
endblock
%}
{%
block
content
%}
{%
if
club_list
%}
<h3>
{%
trans
%}
Club stats
{%
endtrans
%}
</h3>
<form
action=
""
method=
"GET"
>
{%
csrf_token
%}
<p>
<select
name=
"branch"
>
{%
for
b
in
settings.SITH_PROFILE_DEPARTMENTS
%}
<option
value=
"
{{
b
[
0
]
}}
"
>
{{
b
[
0
]
}}
</option>
{%
endfor
%}
</select>
</p>
<p><input
type=
"submit"
value=
"
{%
trans
%}
Show
{%
endtrans
%}
"
/></p>
</form>
<table>
<thead>
<tr>
<td>
Club
</td>
<td>
Member number
</td>
<td>
Old member number
</td>
</tr>
</thead>
<tbody>
{%
for
c
in
club_list.order_by
(
'id'
)
%}
{%
set
members
=
c.members.all
()
%}
{%
if
request.GET
[
'branch'
]
%}
{%
set
members
=
members.
filter
(
user__department
=
request.GET
[
'branch'
])
%}
{%
endif
%}
<tr>
<td>
{{
c.get_display_name
()
}}
</td>
<td>
{{
members.filter
(
end_date
=
None
,
role__gt
=
settings.SITH_MAXIMUM_FREE_ROLE
)
.
count
()
}}
</td>
<td>
{{
members.exclude
(
end_date
=
None
,
role__gt
=
settings.SITH_MAXIMUM_FREE_ROLE
)
.
count
()
}}
</td>
</tr>
{%
endfor
%}
</tbody>
</table>
{%
else
%}
{%
trans
%}
There is no club in this website.
{%
endtrans
%}
{%
endif
%}
{%
endblock
%}
club/urls.py
View file @
114272df
...
...
@@ -5,6 +5,7 @@ from club.views import *
urlpatterns
=
[
url
(
r
'^$'
,
ClubListView
.
as_view
(),
name
=
'club_list'
),
url
(
r
'^new$'
,
ClubCreateView
.
as_view
(),
name
=
'club_new'
),
url
(
r
'^stats$'
,
ClubStatView
.
as_view
(),
name
=
'club_stats'
),
url
(
r
'^(?P<club_id>[0-9]+)/$'
,
ClubView
.
as_view
(),
name
=
'club_view'
),
url
(
r
'^(?P<club_id>[0-9]+)/edit$'
,
ClubEditView
.
as_view
(),
name
=
'club_edit'
),
url
(
r
'^(?P<club_id>[0-9]+)/members$'
,
ClubMembersView
.
as_view
(),
name
=
'club_members'
),
...
...
club/views.py
View file @
114272df
from
django
import
forms
from
django.shortcuts
import
render
from
django.views.generic
import
ListView
,
DetailView
from
django.views.generic
import
ListView
,
DetailView
,
TemplateView
from
django.views.generic.edit
import
UpdateView
,
CreateView
from
django.forms
import
CheckboxSelectMultiple
from
django.core.exceptions
import
ValidationError
...
...
@@ -17,6 +17,7 @@ from datetime import timedelta
from
core.views
import
CanViewMixin
,
CanEditMixin
,
CanEditPropMixin
,
TabedViewMixin
from
core.views.forms
import
SelectDate
,
SelectSingle
,
SelectDateTime
from
club.models
import
Club
,
Membership
from
core.models
import
User
from
sith.settings
import
SITH_MAXIMUM_FREE_ROLE
,
SITH_MAIN_BOARD_GROUP
from
counter.models
import
Product
,
Selling
,
Counter
...
...
@@ -283,3 +284,10 @@ class MembershipSetOldView(CanEditMixin, DetailView):
self
.
object
=
self
.
get_object
()
return
HttpResponseRedirect
(
reverse
(
'club:club_members'
,
args
=
self
.
args
,
kwargs
=
{
'club_id'
:
self
.
object
.
club
.
id
}))
class
ClubStatView
(
TemplateView
):
template_name
=
"club/stats.jinja"
def
get_context_data
(
self
,
**
kwargs
):
kwargs
=
super
(
ClubStatView
,
self
).
get_context_data
(
**
kwargs
)
kwargs
[
'club_list'
]
=
Club
.
objects
.
all
()
return
kwargs
core/models.py
View file @
114272df
...
...
@@ -143,21 +143,8 @@ class User(AbstractBaseUser):
(
"FORMER STUDENT"
,
_
(
"Former student"
)),
(
"SERVICE"
,
_
(
"Service"
)),
],
blank
=
True
,
default
=
""
)
department
=
models
.
CharField
(
_
(
"department"
),
max_length
=
15
,
choices
=
[
(
"TC"
,
_
(
"TC"
)),
(
"IMSI"
,
_
(
"IMSI"
)),
(
"IMAP"
,
_
(
"IMAP"
)),
(
"INFO"
,
_
(
"INFO"
)),
(
"GI"
,
_
(
"GI"
)),
(
"E"
,
_
(
"E"
)),
(
"EE"
,
_
(
"EE"
)),
(
"GESC"
,
_
(
"GESC"
)),
(
"GMC"
,
_
(
"GMC"
)),
(
"MC"
,
_
(
"MC"
)),
(
"EDIM"
,
_
(
"EDIM"
)),
(
"HUMA"
,
_
(
"Humanities"
)),
(
"NA"
,
_
(
"N/A"
)),
],
default
=
"NA"
,
blank
=
True
)
department
=
models
.
CharField
(
_
(
"department"
),
max_length
=
15
,
choices
=
settings
.
SITH_PROFILE_DEPARTMENTS
,
default
=
"NA"
,
blank
=
True
)
dpt_option
=
models
.
CharField
(
_
(
"dpt option"
),
max_length
=
32
,
blank
=
True
,
default
=
""
)
semester
=
models
.
CharField
(
_
(
"semester"
),
max_length
=
5
,
blank
=
True
,
default
=
""
)
quote
=
models
.
CharField
(
_
(
"quote"
),
max_length
=
256
,
blank
=
True
,
default
=
""
)
...
...
sith/settings.py
View file @
114272df
...
...
@@ -282,6 +282,22 @@ SITH_MEMBER_SUFFIX="-membres"
SITH_MAIN_BOARD_GROUP
=
SITH_MAIN_CLUB
[
'unix_name'
]
+
SITH_BOARD_SUFFIX
SITH_MAIN_MEMBERS_GROUP
=
SITH_MAIN_CLUB
[
'unix_name'
]
+
SITH_MEMBER_SUFFIX
SITH_PROFILE_DEPARTMENTS
=
[
(
"TC"
,
_
(
"TC"
)),
(
"IMSI"
,
_
(
"IMSI"
)),
(
"IMAP"
,
_
(
"IMAP"
)),
(
"INFO"
,
_
(
"INFO"
)),
(
"GI"
,
_
(
"GI"
)),
(
"E"
,
_
(
"E"
)),
(
"EE"
,
_
(
"EE"
)),
(
"GESC"
,
_
(
"GESC"
)),
(
"GMC"
,
_
(
"GMC"
)),
(
"MC"
,
_
(
"MC"
)),
(
"EDIM"
,
_
(
"EDIM"
)),
(
"HUMA"
,
_
(
"Humanities"
)),
(
"NA"
,
_
(
"N/A"
)),
]
SITH_ACCOUNTING_PAYMENT_METHOD
=
[
(
'CHECK'
,
_
(
'Check'
)),
(
'CASH'
,
_
(
'Cash'
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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