Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
16814bd6
authored
Feb 02, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
school: admin++
parent
876f4b6f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
school/admin.py
+8
-3
school/models.py
+5
-0
No files found.
school/admin.py
View file @
16814bd6
...
@@ -7,20 +7,25 @@ import string
...
@@ -7,20 +7,25 @@ import string
class
GroupInline
(
contrib
.
admin
.
TabularInline
):
class
GroupInline
(
contrib
.
admin
.
TabularInline
):
model
=
models
.
Group
model
=
models
.
Group
extra
=
2
extra
=
3
class
CourseAdmin
(
contrib
.
admin
.
ModelAdmin
):
class
CourseAdmin
(
contrib
.
admin
.
ModelAdmin
):
model
=
models
.
Course
model
=
models
.
Course
inlines
=
(
GroupInline
,
)
inlines
=
(
GroupInline
,
)
filter_horizontal
=
(
'owners'
,
)
filter_horizontal
=
(
'owners'
,
)
list_display
=
(
'code'
,
'name'
,
'short_name'
,
'owner_list'
)
list_editable
=
(
'name'
,
'short_name'
)
class
GroupAdmin
(
contrib
.
admin
.
ModelAdmin
):
class
GroupAdmin
(
contrib
.
admin
.
ModelAdmin
):
model
=
models
.
Group
model
=
models
.
Group
filter_horizontal
=
(
'owners'
,
'members'
,
)
filter_horizontal
=
(
'owners'
,
'members'
,
)
list_display
=
(
'name'
,
'course'
,
'semester'
,
'owner_list'
,
'member_count'
)
list_display
=
(
'name'
,
'course'
,
'semester'
,
'owner_list'
,
'member_count'
)
list_filter
=
(
'semester'
,
'course'
)
class
SemesterAdmin
(
contrib
.
admin
.
ModelAdmin
):
class
SemesterAdmin
(
contrib
.
admin
.
ModelAdmin
):
model
=
models
.
Semester
model
=
models
.
Semester
list_display
=
(
'id'
,
'name'
,
'start'
,
'end'
)
list_editable
=
(
'name'
,
'start'
,
'end'
)
contrib
.
admin
.
site
.
register
(
models
.
Course
,
CourseAdmin
)
contrib
.
admin
.
site
.
register
(
models
.
Course
,
CourseAdmin
)
contrib
.
admin
.
site
.
register
(
models
.
Semester
,
SemesterAdmin
)
contrib
.
admin
.
site
.
register
(
models
.
Semester
,
SemesterAdmin
)
...
...
school/models.py
View file @
16814bd6
...
@@ -48,6 +48,11 @@ class Course(models.Model):
...
@@ -48,6 +48,11 @@ class Course(models.Model):
return
self
.
short_name
return
self
.
short_name
else
:
else
:
return
self
.
code
return
self
.
code
def
owner_list
(
self
):
if
self
.
owners
:
return
", "
.
join
([
u
.
last_name
if
u
.
last_name
else
u
.
username
for
u
in
self
.
owners
.
all
()])
else
:
return
_
(
"n/a"
)
class
Semester
(
models
.
Model
):
class
Semester
(
models
.
Model
):
...
...
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