Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PyPrevention
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sr04
PyPrevention
Commits
4ea6e0d7
Commit
4ea6e0d7
authored
Oct 30, 2018
by
Hippolyte Vergnol (Hive)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify models
parent
326ca66c
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
92 additions
and
6 deletions
+92
-6
pyprevention/dashboard/__pycache__/models.cpython-36.pyc
pyprevention/dashboard/__pycache__/models.cpython-36.pyc
+0
-0
pyprevention/dashboard/__pycache__/urls.cpython-36.pyc
pyprevention/dashboard/__pycache__/urls.cpython-36.pyc
+0
-0
pyprevention/dashboard/__pycache__/views.cpython-36.pyc
pyprevention/dashboard/__pycache__/views.cpython-36.pyc
+0
-0
pyprevention/dashboard/migrations/0007_auto_20181030_0826.py
pyprevention/dashboard/migrations/0007_auto_20181030_0826.py
+18
-0
pyprevention/dashboard/migrations/0008_auto_20181030_0828.py
pyprevention/dashboard/migrations/0008_auto_20181030_0828.py
+18
-0
pyprevention/dashboard/migrations/__pycache__/0007_auto_20181030_0826.cpython-36.pyc
...ations/__pycache__/0007_auto_20181030_0826.cpython-36.pyc
+0
-0
pyprevention/dashboard/migrations/__pycache__/0008_auto_20181030_0828.cpython-36.pyc
...ations/__pycache__/0008_auto_20181030_0828.cpython-36.pyc
+0
-0
pyprevention/dashboard/models.py
pyprevention/dashboard/models.py
+3
-3
pyprevention/dashboard/templates/base.html
pyprevention/dashboard/templates/base.html
+1
-0
pyprevention/dashboard/templates/doctors.html
pyprevention/dashboard/templates/doctors.html
+1
-1
pyprevention/dashboard/templates/interface.html
pyprevention/dashboard/templates/interface.html
+1
-1
pyprevention/dashboard/templates/patients.html
pyprevention/dashboard/templates/patients.html
+1
-1
pyprevention/dashboard/urls.py
pyprevention/dashboard/urls.py
+3
-0
pyprevention/dashboard/views.py
pyprevention/dashboard/views.py
+46
-0
pyprevention/db.sqlite3
pyprevention/db.sqlite3
+0
-0
No files found.
pyprevention/dashboard/__pycache__/models.cpython-36.pyc
View file @
4ea6e0d7
No preview for this file type
pyprevention/dashboard/__pycache__/urls.cpython-36.pyc
View file @
4ea6e0d7
No preview for this file type
pyprevention/dashboard/__pycache__/views.cpython-36.pyc
View file @
4ea6e0d7
No preview for this file type
pyprevention/dashboard/migrations/0007_auto_20181030_0826.py
0 → 100644
View file @
4ea6e0d7
# Generated by Django 2.1.2 on 2018-10-30 08:26
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'dashboard'
,
'0006_auto_20181029_2025'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'raspi'
,
name
=
'status'
,
field
=
models
.
CharField
(
choices
=
[(
'UP'
,
'UP'
),
(
'DOWN'
,
'DOWN'
)],
max_length
=
5
),
),
]
pyprevention/dashboard/migrations/0008_auto_20181030_0828.py
0 → 100644
View file @
4ea6e0d7
# Generated by Django 2.1.2 on 2018-10-30 08:28
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'dashboard'
,
'0007_auto_20181030_0826'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'raspi'
,
name
=
'status'
,
field
=
models
.
CharField
(
choices
=
[(
'UP'
,
'UP'
),
(
'DOWN'
,
'DOWN'
)],
default
=
'UP'
,
max_length
=
5
),
),
]
pyprevention/dashboard/migrations/__pycache__/0007_auto_20181030_0826.cpython-36.pyc
0 → 100644
View file @
4ea6e0d7
File added
pyprevention/dashboard/migrations/__pycache__/0008_auto_20181030_0828.cpython-36.pyc
0 → 100644
View file @
4ea6e0d7
File added
pyprevention/dashboard/models.py
View file @
4ea6e0d7
...
...
@@ -20,8 +20,8 @@ class Patient(models.Model):
class
Raspi
(
models
.
Model
):
STATUS_CHOICES
=
[
(
'
up'
,
'up
'
),
(
'
down'
,
'down
'
),
(
'
UP'
,
'UP
'
),
(
'
DOWN'
,
'DOWN
'
),
]
ip
=
models
.
CharField
(
max_length
=
50
)
status
=
models
.
CharField
(
max_length
=
5
,
choices
=
STATUS_CHOICES
)
status
=
models
.
CharField
(
max_length
=
5
,
choices
=
STATUS_CHOICES
,
default
=
"UP"
)
pyprevention/dashboard/templates/base.html
View file @
4ea6e0d7
...
...
@@ -10,6 +10,7 @@
<a
class=
"navbar-brand"
href=
"{% url 'index' %}"
>
<img
width=
"30"
height=
"30"
src=
"{% static "
heart.png
"
%}"
alt=
"icon"
>
PyPrevention
</a>
<center>
<a
class=
"btn btn-dark"
type=
"button"
href=
"{% url 'index' %}"
>
Home
</a>
<a
class=
"btn btn-dark"
type=
"button"
href=
"{% url 'dashboard' %}"
>
Dashboard
</a>
</center>
{% if user.is_authenticated %}
...
...
pyprevention/dashboard/templates/doctors.html
View file @
4ea6e0d7
...
...
@@ -12,7 +12,7 @@
<h5
class=
"card-title"
>
{{doctor.first_name}} {{doctor.last_name}}
</h5>
<p
class=
"card-text"
>
Email : {{doctor.email}}
</p>
<p
class=
"card-text"
>
Address : {{doctor.address}}
</p>
<a
href=
"
#
"
class=
"btn btn-dark"
>
Modify
</a>
<a
href=
"
{% url 'update_doctor' id=doctor.id %}
"
class=
"btn btn-dark"
>
Modify
</a>
<a
href=
"{% url 'delete_doctor' id=doctor.id %}"
class=
"btn btn-danger"
>
Delete
</a>
</div>
</div>
...
...
pyprevention/dashboard/templates/interface.html
View file @
4ea6e0d7
...
...
@@ -19,7 +19,7 @@
{% else %}
<p>
Status :
<span
class=
"badge badge-secondary"
>
Unknown
</span>
</p>
{% endif %}
<a
href=
"
#
"
class=
"btn btn-dark"
>
Modify
</a>
<a
href=
"
{% url 'update_raspi' id=pi.id %}
"
class=
"btn btn-dark"
>
Modify
</a>
<a
href=
"{% url 'delete_raspi' id=pi.id %}"
class=
"btn btn-danger"
>
Delete
</a>
</center>
</div>
...
...
pyprevention/dashboard/templates/patients.html
View file @
4ea6e0d7
...
...
@@ -13,7 +13,7 @@
<h5
class=
"card-title"
>
{{patient.first_name}} {{patient.last_name}}
</h5>
<p
class=
"card-text"
>
Date of birth : {{patient.date_of_birth}}
</p>
<p
class=
"card-text"
>
Doctor : {{patient.doctor.first_name}} {{patient.doctor.last_name}}
</p>
<a
href=
"
#
"
class=
"btn btn-dark"
>
Modify
</a>
<a
href=
"
{% url 'update_patient' id=patient.id %}
"
class=
"btn btn-dark"
>
Modify
</a>
<a
href=
"{% url 'delete_patient' id=patient.id %}"
class=
"btn btn-danger"
>
Delete
</a>
</center>
</div>
...
...
pyprevention/dashboard/urls.py
View file @
4ea6e0d7
...
...
@@ -19,4 +19,7 @@ urlpatterns = [
path
(
'delete/raspi/<int:id>'
,
views
.
delete_raspi
,
name
=
'delete_raspi'
),
path
(
'delete/doctor/<int:id>'
,
views
.
delete_doctor
,
name
=
'delete_doctor'
),
path
(
'delete/patient/<int:id>'
,
views
.
delete_patient
,
name
=
'delete_patient'
),
path
(
'update/raspi/<int:id>'
,
views
.
update_raspi
,
name
=
'update_raspi'
),
path
(
'update/doctor/<int:id>'
,
views
.
update_doctor
,
name
=
'update_doctor'
),
path
(
'update/patient/<int:id>'
,
views
.
update_patient
,
name
=
'update_patient'
),
]
pyprevention/dashboard/views.py
View file @
4ea6e0d7
...
...
@@ -101,3 +101,49 @@ def delete_patient(request, id):
def
delete_doctor
(
request
,
id
):
u
=
Doctor
.
objects
.
filter
(
id
=
id
).
delete
()
return
redirect
(
'doctors'
)
@
login_required
def
update_raspi
(
request
,
id
):
instance
=
Raspi
.
objects
.
filter
(
id
=
id
).
last
()
if
request
.
method
==
"POST"
:
form
=
RaspiForm
(
request
.
POST
or
None
,
instance
=
instance
)
if
form
.
is_valid
():
instance
.
ip
=
form
.
cleaned_data
[
'ip'
]
instance
.
status
=
form
.
cleaned_data
[
'status'
]
instance
.
save
()
return
redirect
(
'interface'
)
else
:
form
=
RaspiForm
(
request
.
POST
or
None
,
instance
=
instance
)
return
render
(
request
,
'raspi_add.html'
,
{
'form'
:
form
})
@
login_required
def
update_patient
(
request
,
id
):
instance
=
Patient
.
objects
.
filter
(
id
=
id
).
last
()
if
request
.
method
==
"POST"
:
form
=
PatientForm
(
request
.
POST
or
None
,
instance
=
instance
)
if
form
.
is_valid
():
instance
.
first_name
=
form
.
cleaned_data
[
'first_name'
]
instance
.
last_name
=
form
.
cleaned_data
[
'last_name'
]
instance
.
date_of_birth
=
form
.
cleaned_data
[
'date_of_birth'
]
instance
.
doctor
=
form
.
cleaned_data
[
'doctor'
]
instance
.
save
()
return
redirect
(
'patients'
)
else
:
form
=
PatientForm
(
request
.
POST
or
None
,
instance
=
instance
)
return
render
(
request
,
'patient_add.html'
,
{
'form'
:
form
})
@
login_required
def
update_doctor
(
request
,
id
):
instance
=
Doctor
.
objects
.
filter
(
id
=
id
).
last
()
if
request
.
method
==
"POST"
:
form
=
DoctorForm
(
request
.
POST
or
None
,
instance
=
instance
)
if
form
.
is_valid
():
instance
.
first_name
=
form
.
cleaned_data
[
'first_name'
]
instance
.
last_name
=
form
.
cleaned_data
[
'last_name'
]
instance
.
email
=
form
.
cleaned_data
[
'email'
]
instance
.
address
=
form
.
cleaned_data
[
'address'
]
instance
.
save
()
return
redirect
(
'doctors'
)
else
:
form
=
DoctorForm
(
request
.
POST
or
None
,
instance
=
instance
)
return
render
(
request
,
'doctor_add.html'
,
{
'form'
:
form
})
pyprevention/db.sqlite3
View file @
4ea6e0d7
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment