Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
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
Package registry
Container 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
ots
hypha
Commits
7bfea125
Unverified
Commit
7bfea125
authored
5 years ago
by
George Hickman
Browse files
Options
Downloads
Patches
Plain Diff
Split apart URL generation
parent
b4fcde1d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentech/apply/funds/admin.py
+2
-14
2 additions, 14 deletions
opentech/apply/funds/admin.py
with
2 additions
and
14 deletions
opentech/apply/funds/admin.py
+
2
−
14
View file @
7bfea125
...
...
@@ -32,7 +32,7 @@ class RoundAdmin(BaseRoundAdmin):
def
applications
(
self
,
obj
):
def
build_urls
(
applications
):
for
application
in
applications
:
url
=
self
.
get_other_
admin_edit
_url
(
application
.
form
)
url
=
reverse
(
'
funds_applicationform_model
admin_edit
'
,
args
=
[
application
.
id
]
)
yield
f
'
<a href=
"
{
url
}
"
>
{
application
}
</a>
'
urls
=
list
(
build_urls
(
obj
.
forms
.
all
()))
...
...
@@ -47,22 +47,10 @@ class RoundAdmin(BaseRoundAdmin):
url_tag
=
f
'
<a href=
"
{
url
}
"
>
{
obj
.
fund
}
</a>
'
return
mark_safe
(
url_tag
)
def
get_other_admin_edit_url
(
self
,
obj
):
"""
Build an admin URL for the given obj.
This builds a ModelAdmin URL for the given object, mirroring Wagtail
'
s
ModelAdmin.url_helper.get_action_url but works for any ModelAdmin.
"""
app_label
=
obj
.
_meta
.
app_label
model_name
=
obj
.
_meta
.
model_name
url_name
=
f
'
{
app_label
}
_
{
model_name
}
_modeladmin_edit
'
return
reverse
(
url_name
,
args
=
[
obj
.
id
])
def
review_forms
(
self
,
obj
):
def
build_urls
(
review_forms
):
for
review_form
in
review_forms
:
url
=
self
.
get_other_
admin_edit
_url
(
review_form
)
url
=
reverse
(
'
funds_round_model
admin_edit
'
,
args
=
[
review_form
.
id
]
)
yield
f
'
<a href=
"
{
url
}
"
>
{
review_form
}
</a>
'
urls
=
list
(
build_urls
(
obj
.
review_forms
.
all
()))
...
...
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