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
concrexit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
70
Issues
70
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
thalia
concrexit
Commits
211e361a
Commit
211e361a
authored
Jul 13, 2016
by
Thom Wiggers
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'committees/boards' into 'master'
Add boards Closes
#11
See merge request
!6
parents
41c943c8
458853df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
7 deletions
+81
-7
website/committees/admin.py
website/committees/admin.py
+18
-3
website/committees/migrations/0003_auto_20160713_1700.py
website/committees/migrations/0003_auto_20160713_1700.py
+29
-0
website/committees/models.py
website/committees/models.py
+34
-4
No files found.
website/committees/admin.py
View file @
211e361a
...
...
@@ -2,6 +2,21 @@ from django.contrib import admin
from
.
import
models
admin
.
site
.
register
(
models
.
Committee
)
admin
.
site
.
register
(
models
.
CommitteeMembership
)
# Register your models here.
@
admin
.
register
(
models
.
Committee
)
class
CommitteeAdmin
(
admin
.
ModelAdmin
):
list_filter
=
(
'until'
,)
def
get_queryset
(
self
,
request
):
qs
=
super
().
get_queryset
(
request
)
return
qs
.
exclude
(
board__is_board
=
True
)
@
admin
.
register
(
models
.
Board
)
class
BoardAdmin
(
admin
.
ModelAdmin
):
exclude
=
(
'is_board'
,)
@
admin
.
register
(
models
.
CommitteeMembership
)
class
CommitteeMembershipAdmin
(
admin
.
ModelAdmin
):
pass
website/committees/migrations/0003_auto_20160713_1700.py
0 → 100644
View file @
211e361a
# -*- coding: utf-8 -*-
# Generated by Django 1.10b1 on 2016-07-13 15:00
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'committees'
,
'0002_auto_20160713_1558'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Board'
,
fields
=
[
(
'committee_ptr'
,
models
.
OneToOneField
(
auto_created
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
parent_link
=
True
,
primary_key
=
True
,
serialize
=
False
,
to
=
'committees.Committee'
)),
(
'is_board'
,
models
.
BooleanField
(
default
=
True
,
verbose_name
=
'Is this a board'
)),
],
bases
=
(
'committees.committee'
,),
),
migrations
.
AddField
(
model_name
=
'committeemembership'
,
name
=
'role'
,
field
=
models
.
CharField
(
blank
=
True
,
help_text
=
'The role of this member'
,
max_length
=
255
,
null
=
True
,
verbose_name
=
'role'
),
),
]
website/committees/models.py
View file @
211e361a
...
...
@@ -13,17 +13,25 @@ from members.models import Member
logger
=
logging
.
getLogger
(
__name__
)
class
ActiveCommitteesManager
(
models
.
Manager
):
class
CommitteeManager
(
models
.
Manager
):
"""Returns committees only"""
def
get_queryset
(
self
):
return
(
super
().
get_queryset
()
.
exclude
(
board__is_board
=
True
))
class
ActiveCommitteeManager
(
models
.
Manager
):
"""Returns active committees only"""
def
get_queryset
(
self
):
return
super
().
get_queryset
().
exclude
(
until__lt
=
timezone
.
now
().
date
())
return
(
super
().
get_queryset
()
.
exclude
(
until__lt
=
timezone
.
now
().
date
()))
class
Committee
(
models
.
Model
):
"""A committee"""
active_committees
=
ActiveCommittee
s
Manager
()
objects
=
models
.
Manager
()
active_committees
=
ActiveCommitteeManager
()
objects
=
Committee
Manager
()
name
=
models
.
CharField
(
max_length
=
40
,
...
...
@@ -72,6 +80,20 @@ class Committee(models.Model):
verbose_name_plural
=
_
(
'committees'
)
class
BoardManager
(
models
.
Manager
):
def
get_queryset
(
self
):
return
super
().
get_queryset
().
filter
(
is_board
=
True
)
class
Board
(
Committee
):
objects
=
BoardManager
()
is_board
=
models
.
BooleanField
(
verbose_name
=
_
(
'Is this a board'
),
default
=
True
,
)
class
ActiveMembershipManager
(
models
.
Manager
):
"""Get only active memberships"""
def
get_queryset
(
self
):
...
...
@@ -115,6 +137,14 @@ class CommitteeMembership(models.Model):
default
=
False
,
)
role
=
models
.
CharField
(
_
(
'role'
),
help_text
=
_
(
'The role of this member'
),
max_length
=
255
,
blank
=
True
,
null
=
True
,
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
...
...
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