Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
SMASCH
scheduling-system
Commits
0fea31a8
There was a problem fetching the pipeline metadata.
Commit
0fea31a8
authored
8 years ago
by
Valentin Groues
Browse files
Options
Downloads
Patches
Plain Diff
redirect to subject details after adding a subject -
#86
parent
40ecf864
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!33
redirect to subject details after adding a subject - #86
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
smash/web/templates/_base.html
+13
-0
13 additions, 0 deletions
smash/web/templates/_base.html
smash/web/tests/test_view_subjects.py
+10
-8
10 additions, 8 deletions
smash/web/tests/test_view_subjects.py
smash/web/views/subject.py
+3
-2
3 additions, 2 deletions
smash/web/views/subject.py
with
26 additions
and
10 deletions
smash/web/templates/_base.html
+
13
−
0
View file @
0fea31a8
...
@@ -240,6 +240,19 @@ desired effect
...
@@ -240,6 +240,19 @@ desired effect
<!-- Main content -->
<!-- Main content -->
<section
class=
"content"
>
<section
class=
"content"
>
{% block messages %}
{% if messages %}
<div
class=
"messages"
>
{% for message in messages %}
<div
class=
"alert {% if message.tags %}alert-{{ message.tags }}{% endif %} alert-dismissible"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
aria-hidden=
"true"
>
×
</button>
<h4>
{{ message.tags | title }}
</h4>
{{ message }}
</div>
{% endfor %}
</div>
{% endif %}
{% endblock %}
{% block maincontent %}
{% block maincontent %}
{% endblock maincontent %}
{% endblock maincontent %}
</section>
</section>
...
...
This diff is collapsed.
Click to expand it.
smash/web/tests/test_view_subjects.py
+
10
−
8
View file @
0fea31a8
...
@@ -42,7 +42,7 @@ class SubjectsViewTests(TestCase):
...
@@ -42,7 +42,7 @@ class SubjectsViewTests(TestCase):
def
test_render_subject_visit_details
(
self
):
def
test_render_subject_visit_details
(
self
):
subject
=
create_subject
()
subject
=
create_subject
()
visit
=
create_visit
(
subject
)
visit
=
create_visit
(
subject
)
appointment
=
create_appointment
(
visit
)
create_appointment
(
visit
)
response
=
self
.
client
.
get
(
reverse
(
'
web.views.subject_visit_details
'
,
kwargs
=
{
'
id
'
:
subject
.
id
}))
response
=
self
.
client
.
get
(
reverse
(
'
web.views.subject_visit_details
'
,
kwargs
=
{
'
id
'
:
subject
.
id
}))
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
...
@@ -75,15 +75,17 @@ class SubjectsViewTests(TestCase):
...
@@ -75,15 +75,17 @@ class SubjectsViewTests(TestCase):
if
value
is
not
None
:
if
value
is
not
None
:
form_data
[
key
]
=
value
form_data
[
key
]
=
value
form_data
[
"
screening_number
"
]
=
"
X-
"
;
form_data
[
"
screening_number
"
]
=
"
X-
"
form_data
[
"
country
"
]
=
"
Luxembourg
"
;
form_data
[
"
country
"
]
=
"
Luxembourg
"
form_data
[
"
first_name
"
]
=
"
John
"
;
form_data
[
"
first_name
"
]
=
"
John
"
form_data
[
"
last_name
"
]
=
"
Doe
"
;
form_data
[
"
last_name
"
]
=
"
Doe
"
form_data
[
"
sex
"
]
=
SEX_CHOICES_MALE
;
form_data
[
"
sex
"
]
=
SEX_CHOICES_MALE
form_data
[
"
type
"
]
=
SUBJECT_TYPE_CHOICES_CONTROL
;
form_data
[
"
type
"
]
=
SUBJECT_TYPE_CHOICES_CONTROL
form_data
[
"
default_location
"
]
=
get_test_location
().
id
;
form_data
[
"
default_location
"
]
=
get_test_location
().
id
response
=
self
.
client
.
post
(
reverse
(
'
web.views.subject_add
'
),
data
=
form_data
)
response
=
self
.
client
.
post
(
reverse
(
'
web.views.subject_add
'
),
data
=
form_data
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
response
=
self
.
client
.
get
(
response
.
url
)
self
.
assertContains
(
response
,
"
Subject created
"
)
subject
=
Subject
.
objects
.
all
()[
0
]
subject
=
Subject
.
objects
.
all
()[
0
]
self
.
assertEqual
(
"
X-001
"
,
subject
.
screening_number
)
self
.
assertEqual
(
"
X-001
"
,
subject
.
screening_number
)
...
...
This diff is collapsed.
Click to expand it.
smash/web/views/subject.py
+
3
−
2
View file @
0fea31a8
# coding=utf-8
# coding=utf-8
from
django.contrib
import
messages
from
django.shortcuts
import
redirect
,
get_object_or_404
from
django.shortcuts
import
redirect
,
get_object_or_404
from
notifications
import
get_subjects_with_no_visit
,
get_subjects_with_reminder
from
notifications
import
get_subjects_with_no_visit
,
get_subjects_with_reminder
...
@@ -22,7 +22,8 @@ def subject_add(request):
...
@@ -22,7 +22,8 @@ def subject_add(request):
form
=
SubjectAddForm
(
request
.
POST
,
request
.
FILES
,
user
=
request
.
user
)
form
=
SubjectAddForm
(
request
.
POST
,
request
.
FILES
,
user
=
request
.
user
)
if
form
.
is_valid
():
if
form
.
is_valid
():
form
.
save
()
form
.
save
()
return
redirect
(
'
web.views.subjects
'
)
messages
.
add_message
(
request
,
messages
.
SUCCESS
,
'
Subject created
'
)
return
redirect
(
'
web.views.subject_edit
'
,
id
=
form
.
instance
.
id
)
else
:
else
:
worker
=
Worker
.
get_by_user
(
request
.
user
)
worker
=
Worker
.
get_by_user
(
request
.
user
)
form
=
SubjectAddForm
(
user
=
request
.
user
,
initial
=
{
'
screening_number
'
:
get_prefix_screening_number
(
worker
)})
form
=
SubjectAddForm
(
user
=
request
.
user
,
initial
=
{
'
screening_number
'
:
get_prefix_screening_number
(
worker
)})
...
...
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