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
3739feea
Commit
3739feea
authored
6 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Move the determination messages to include the request
parent
2ea5ad73
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/apply/determinations/models.py
+0
-25
0 additions, 25 deletions
opentech/apply/determinations/models.py
opentech/apply/determinations/views.py
+16
-0
16 additions, 0 deletions
opentech/apply/determinations/views.py
with
16 additions
and
25 deletions
opentech/apply/determinations/models.py
+
0
−
25
View file @
3739feea
...
...
@@ -2,8 +2,6 @@ import bleach
from
django.conf
import
settings
from
django.contrib.postgres.fields
import
JSONField
from
django.db
import
models
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
from
django.urls
import
reverse
from
django.utils.translation
import
ugettext_lazy
as
_
from
wagtail.admin.edit_handlers
import
TabbedInterface
,
ObjectList
,
FieldPanel
...
...
@@ -11,9 +9,6 @@ from wagtail.contrib.settings.models import BaseSetting
from
wagtail.contrib.settings.registry
import
register_setting
from
wagtail.core.fields
import
RichTextField
from
opentech.apply.activity.models
import
Activity
from
opentech.apply.activity.messaging
import
messenger
,
MESSAGES
REJECTED
=
0
NEEDS_MORE_INFO
=
1
...
...
@@ -68,26 +63,6 @@ class Determination(models.Model):
return
f
'
<
{
self
.
__class__
.
__name__
}
:
{
str
(
self
.
data
)
}
>
'
@receiver
(
post_save
,
sender
=
Determination
)
def
log_determination_activity
(
sender
,
**
kwargs
):
determination
=
kwargs
.
get
(
'
instance
'
)
if
kwargs
.
get
(
'
created
'
,
False
):
messenger
(
MESSAGES
.
NEW_DETERMINATION
,
user
=
determination
.
author
,
submission
=
determination
.
submission
,
)
if
not
kwargs
.
get
(
'
is_draft
'
,
False
):
submission
=
determination
.
submission
messenger
(
MESSAGES
.
DETERMINATION_OUTCOME
,
user
=
determination
.
author
,
submission
=
submission
,
)
@register_setting
class
DeterminationMessageSettings
(
BaseSetting
):
class
Meta
:
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/determinations/views.py
+
16
−
0
View file @
3739feea
...
...
@@ -74,11 +74,27 @@ class DeterminationCreateOrUpdateView(CreateOrUpdateView):
return
self
.
submission
.
get_absolute_url
()
def
form_valid
(
self
,
form
):
is_new
=
not
form
.
instance
.
id
response
=
super
().
form_valid
(
form
)
if
not
self
.
object
.
is_draft
:
messenger
(
MESSAGES
.
DETERMINATION_OUTCOME
,
request
=
self
.
request
,
user
=
self
.
object
.
author
,
submission
=
self
.
object
.
submission
,
)
action_name
=
self
.
get_action_name_from_determination
(
int
(
form
.
cleaned_data
.
get
(
'
outcome
'
)))
self
.
submission
.
perform_transition
(
action_name
,
self
.
request
.
user
)
elif
is_new
:
messenger
(
MESSAGES
.
NEW_DETERMINATION
,
request
=
self
.
request
,
user
=
self
.
object
.
author
,
submission
=
self
.
object
.
submission
,
)
return
self
.
progress_stage
(
self
.
submission
)
or
response
...
...
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