Skip to content

Commit

Permalink
Connected PostgresSQL with the app, created Patient entity, removed p…
Browse files Browse the repository at this point in the history
…revious codes. #12
  • Loading branch information
DejanPerovic committed Jun 14, 2024
1 parent 1dfeae6 commit 3935af2
Show file tree
Hide file tree
Showing 25 changed files with 92 additions and 134 deletions.
10 changes: 7 additions & 3 deletions CMS/CMS/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"appointments",
"patient",
]

MIDDLEWARE = [
Expand Down Expand Up @@ -77,8 +77,12 @@

DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
"ENGINE": "django.db.backends.postgresql",
"NAME": "clinic_management_system",
"USER": "postgres",
"PASSWORD": "root",
"HOST": "localhost",
"PORT": "5432",
}
}

Expand Down
1 change: 0 additions & 1 deletion CMS/CMS/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@

urlpatterns = [
path("admin/", admin.site.urls),
path('appointments/', include('appointments.urls')),
]
5 changes: 0 additions & 5 deletions CMS/appointments/admin.py

This file was deleted.

6 changes: 0 additions & 6 deletions CMS/appointments/apps.py

This file was deleted.

7 changes: 0 additions & 7 deletions CMS/appointments/forms.py

This file was deleted.

21 changes: 0 additions & 21 deletions CMS/appointments/models.py

This file was deleted.

23 changes: 0 additions & 23 deletions CMS/appointments/templates/appointments/appointment_detail.html

This file was deleted.

29 changes: 0 additions & 29 deletions CMS/appointments/templates/base.html

This file was deleted.

6 changes: 0 additions & 6 deletions CMS/appointments/urls.py

This file was deleted.

20 changes: 0 additions & 20 deletions CMS/appointments/views.py

This file was deleted.

File renamed without changes.
2 changes: 2 additions & 0 deletions CMS/users/admin.py → CMS/patient/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.contrib import admin
from .models import Patient

# Register your models here.
admin.site.register(Patient)
6 changes: 6 additions & 0 deletions CMS/patient/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class PatientConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'patient'
35 changes: 35 additions & 0 deletions CMS/patient/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 5.0.6 on 2024-06-14 16:25

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Patient',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=100)),
('last_name', models.CharField(max_length=100)),
('birth_date', models.DateField()),
('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1)),
('address', models.CharField(max_length=255)),
('phone', models.CharField(max_length=20)),
('email', models.EmailField(max_length=254)),
('registration_date', models.DateTimeField()),
('last_visit', models.DateTimeField()),
('insurance', models.CharField(choices=[('YES', 'Yes'), ('NO', 'No')], max_length=3)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'patient',
},
),
]
17 changes: 17 additions & 0 deletions CMS/patient/migrations/0002_alter_patient_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.0.6 on 2024-06-14 16:41

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('patient', '0001_initial'),
]

operations = [
migrations.AlterModelOptions(
name='patient',
options={'managed': False},
),
]
File renamed without changes.
24 changes: 24 additions & 0 deletions CMS/patient/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django.db import models


class Patient(models.Model):
patient_id = models.AutoField(primary_key=True)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
birth_date = models.DateField()
gender = models.CharField(max_length=1, choices=[('M', 'Male'), ('F', 'Female')])
address = models.CharField(max_length=255)
phone = models.CharField(max_length=20)
email = models.EmailField()
registration_date = models.DateTimeField()
last_visit = models.DateTimeField()
insurance = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

class Meta:
managed = False
db_table = 'patient'

def __str__(self):
return f"{self.first_name} {self.last_name}"
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion CMS/resources/clinic_management_system_ERD.pgerd

Large diffs are not rendered by default.

Empty file removed CMS/users/__init__.py
Empty file.
6 changes: 0 additions & 6 deletions CMS/users/apps.py

This file was deleted.

Empty file removed CMS/users/migrations/__init__.py
Empty file.
3 changes: 0 additions & 3 deletions CMS/users/models.py

This file was deleted.

3 changes: 0 additions & 3 deletions CMS/users/tests.py

This file was deleted.

0 comments on commit 3935af2

Please sign in to comment.