Skip to content

Commit

Permalink
Merge pull request #11 from MohamedHamed12/hdb-14-enabling-atomic_req…
Browse files Browse the repository at this point in the history
…uests

Hdb 14 enabling atomic requests
  • Loading branch information
MohamedHamed12 authored May 9, 2024
2 parents 9521253 + 79a764c commit 7d71a4f
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 5.0.3 on 2024-05-09 08:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("accounts", "0004_remove_patient_code"),
]

operations = [
migrations.AlterField(
model_name="doctor",
name="experience_years",
field=models.PositiveIntegerField(blank=True, null=True),
),
migrations.AlterField(
model_name="doctor",
name="license_number",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name="doctor",
name="work_days",
field=models.CharField(blank=True, max_length=255, null=True),
),
]
6 changes: 3 additions & 3 deletions project/accounts/models/doctor.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from .models import *
class Doctor(Profile):
speciality = models.CharField(max_length=255)
license_number = models.CharField(max_length=255)
experience_years = models.PositiveIntegerField()
work_days= models.CharField(max_length=255)
license_number = models.CharField(max_length=255,blank=True,null=True)
experience_years = models.PositiveIntegerField( blank=True, null=True)
work_days= models.CharField(max_length=255,blank=True,null=True)

def __str__(self):
return self.first_name
32 changes: 32 additions & 0 deletions project/accounts/tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from accounts.tests.test_setup import *
from accounts.models import *

from accounts.tests.test_setup import *
from accounts.models import *



class PatientTest(TestSetup):
def setUp(self) -> None:
super().setUp()
self.staff, self.staff_token = self.create_staff()

def test_create_doctor(self):
data = {


'national_id': '012345678901234',
'full_name': 'test',



}

# self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.staff_token)
response = self.client.post('/accounts/doctor/', data,
format='json', HTTP_AUTHORIZATION='Bearer ' + self.staff_token)
self.assertEqual(response.status_code, 400)
self.assertEqual(Doctor.objects.count(), 0)
self.assertEqual(User.objects.count(), 1)


2 changes: 1 addition & 1 deletion project/project/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
"REFRESH_TOKEN_LIFETIME": timedelta(days=30), # Adjust based on requirements
}

ATOMIC_REQUESTS = True
# ATOMIC_REQUESTS = True

INTERNAL_IPS = [
# ...
Expand Down
1 change: 1 addition & 0 deletions project/project/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
'ATOMIC_REQUESTS': True
}
}
2 changes: 1 addition & 1 deletion project/project/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

db_config = dj_database_url.config(default=config("DATABASE_URL"))

# db_config['ATOMIC_REQUESTS'] = True
db_config['ATOMIC_REQUESTS'] = True
DATABASES = {
'default': db_config,

Expand Down

0 comments on commit 7d71a4f

Please # to comment.