Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
AURA
steering
Commits
8ad8059f
Commit
8ad8059f
authored
3 years ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
Remove program admin. We do everything over the API
parent
96866e5d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/admin.py
+0
-98
0 additions, 98 deletions
program/admin.py
with
0 additions
and
98 deletions
program/admin.py
deleted
100644 → 0
+
0
−
98
View file @
96866e5d
#
# steering, Programme/schedule management for AURA
#
# Copyright (C) 2011-2017, 2020, Ernesto Rico Schmidt
# Copyright (C) 2017-2019, Ingo Leindecker
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from
django.contrib
import
admin
from
django.utils
import
timezone
from
django.utils.translation
import
gettext_lazy
as
_
from
.models
import
Language
,
Type
,
MusicFocus
,
Category
,
Topic
,
FundingCategory
,
Host
class
ActiveHostsFilter
(
admin
.
SimpleListFilter
):
title
=
_
(
"
Activity
"
)
parameter_name
=
'
has_shows_and_schedules
'
def
lookups
(
self
,
request
,
model_admin
):
return
(
(
'
yes
'
,
_
(
"
active
"
)),
(
'
no
'
,
_
(
"
inactive
"
))
)
def
queryset
(
self
,
request
,
queryset
):
if
self
.
value
()
==
'
yes
'
:
return
queryset
.
filter
(
shows__schedules__until__gt
=
timezone
.
now
()).
distinct
()
if
self
.
value
()
==
'
no
'
:
return
queryset
.
filter
(
shows__schedules__until__lt
=
timezone
.
now
()).
distinct
()
class
TypeAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
type
'
,
'
is_active
'
)
list_filter
=
(
'
is_active
'
,)
prepopulated_fields
=
{
'
slug
'
:
(
'
type
'
,)}
class
MusicFocusAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
focus
'
,
'
abbrev
'
,
'
is_active
'
)
list_filter
=
(
'
is_active
'
,)
prepopulated_fields
=
{
'
slug
'
:
(
'
focus
'
,)}
class
CategoryAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
category
'
,
'
abbrev
'
,
'
is_active
'
)
list_filter
=
(
'
is_active
'
,)
prepopulated_fields
=
{
'
slug
'
:
(
'
category
'
,)}
class
LanguageAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
name
'
,
'
is_active
'
)
list_filter
=
(
'
is_active
'
,)
class
TopicAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
topic
'
,
'
abbrev
'
,
'
is_active
'
)
list_filter
=
(
'
is_active
'
,)
prepopulated_fields
=
{
'
slug
'
:
(
'
topic
'
,)}
class
FundingCategoryAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
fundingcategory
'
,
'
abbrev
'
,
'
is_active
'
)
list_filter
=
(
'
is_active
'
,)
prepopulated_fields
=
{
'
slug
'
:
(
'
fundingcategory
'
,)}
class
HostAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'
name
'
,
'
email
'
,
'
is_active
'
)
list_filter
=
(
ActiveHostsFilter
,
'
is_active
'
,)
def
get_queryset
(
self
,
request
):
if
request
.
user
.
is_superuser
:
return
Host
.
objects
.
all
()
# Common users only see hosts of shows they own
return
Host
.
objects
.
filter
(
shows__in
=
request
.
user
.
shows
.
all
()).
distinct
()
admin
.
site
.
register
(
Language
,
LanguageAdmin
)
admin
.
site
.
register
(
Type
,
TypeAdmin
)
admin
.
site
.
register
(
MusicFocus
,
MusicFocusAdmin
)
admin
.
site
.
register
(
Category
,
CategoryAdmin
)
admin
.
site
.
register
(
Topic
,
TopicAdmin
)
admin
.
site
.
register
(
FundingCategory
,
FundingCategoryAdmin
)
admin
.
site
.
register
(
Host
,
HostAdmin
)
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