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
d0dd072a
There was a problem fetching the pipeline metadata.
Commit
d0dd072a
authored
7 years ago
by
Valentin Groues
Browse files
Options
Downloads
Patches
Plain Diff
hide visit fields in appointment edit view -
#73
parent
e6e28e30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!19
hide visit fields in appointment edit view - #73
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
smash/web/forms.py
+1
-0
1 addition, 0 deletions
smash/web/forms.py
smash/web/tests/test_AppointmentEditForm.py
+7
-2
7 additions, 2 deletions
smash/web/tests/test_AppointmentEditForm.py
smash/web/views.py
+0
-5
0 additions, 5 deletions
smash/web/views.py
with
8 additions
and
7 deletions
smash/web/forms.py
+
1
−
0
View file @
d0dd072a
...
...
@@ -145,6 +145,7 @@ class AppointmentEditForm(ModelForm):
raise
TypeError
(
"
Worker not defined for:
"
+
user
.
username
)
super
(
ModelForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
self
.
fields
.
pop
(
'
visit
'
)
def
clean_location
(
self
):
location
=
self
.
cleaned_data
[
'
location
'
]
...
...
This diff is collapsed.
Click to expand it.
smash/web/tests/test_AppointmentEditForm.py
+
7
−
2
View file @
d0dd072a
...
...
@@ -19,18 +19,23 @@ class AppointmentEditFormTests(TestCase):
self
.
sample_data
=
{
'
first_name
'
:
'
name
'
,
'
length
'
:
'
50
'
,
'
visit
'
:
self
.
visit
.
id
,
'
location
'
:
location
.
id
,
'
datetime_when
'
:
"
2020-01-01
"
,
}
add_form
=
AppointmentAddForm
(
user
=
self
.
user
,
data
=
self
.
sample_data
)
self
.
sample_data_with_visit
=
self
.
sample_data
self
.
sample_data_with_visit
[
'
visit
'
]
=
self
.
visit
.
id
add_form
=
AppointmentAddForm
(
user
=
self
.
user
,
data
=
self
.
sample_data_with_visit
)
self
.
appointment
=
add_form
.
save
()
def
test_validation
(
self
):
form
=
AppointmentEditForm
(
user
=
self
.
user
,
data
=
self
.
sample_data
)
self
.
assertTrue
(
form
.
is_valid
())
def
test_no_visit_field
(
self
):
form
=
AppointmentEditForm
(
user
=
self
.
user
,
data
=
self
.
sample_data
)
self
.
assertNotIn
(
'
visit
'
,
form
.
fields
)
def
test_validation_invalid_location
(
self
):
self
.
sample_data
[
'
location
'
]
=
create_location
(
name
=
"
xxx
"
).
id
form
=
AppointmentEditForm
(
user
=
self
.
user
,
data
=
self
.
sample_data
)
...
...
This diff is collapsed.
Click to expand it.
smash/web/views.py
+
0
−
5
View file @
d0dd072a
...
...
@@ -717,11 +717,6 @@ def appointment_edit(request, id):
if
appointment_form
.
is_valid
()
and
subject_form
.
is_valid
():
appointment_form
.
save
()
subject_form
.
save
()
data
=
appointment_form
.
cleaned_data
vis
=
data
[
'
visit
'
]
get_object_or_404
(
Visit
,
id
=
vis
.
id
)
return
redirect
(
appointments
)
else
:
appointment_form
=
AppointmentEditForm
(
instance
=
the_appointment
,
user
=
request
.
user
,
prefix
=
"
appointment
"
)
...
...
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