diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..182f34c --- /dev/null +++ b/.gitignore @@ -0,0 +1,122 @@ +Source: https://github.com/github/gitignore/blob/master/Python.gitignore + +# User generated +ENV/ +.vscode +.idea +.DS_Store +.history + + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class +.pytest_cache/ + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +.static_storage/ +.media/ +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# js +node_modules/ +.next/ + +# poetry +poetry.lock \ No newline at end of file diff --git a/hospital/__init__.py b/Address/__init__.py similarity index 100% rename from hospital/__init__.py rename to Address/__init__.py diff --git a/Address/admin.py b/Address/admin.py new file mode 100644 index 0000000..62daf73 --- /dev/null +++ b/Address/admin.py @@ -0,0 +1,9 @@ +from django.contrib import admin +from .models import Area,City,Address +# Register your models here. +class TestAdmin(admin.ModelAdmin): + list_display = ('city','area') + +admin.site.register(Area) +admin.site.register(City) +admin.site.register(Address,TestAdmin) \ No newline at end of file diff --git a/hospital/apps.py b/Address/apps.py similarity index 62% rename from hospital/apps.py rename to Address/apps.py index 003288d..efbf01d 100644 --- a/hospital/apps.py +++ b/Address/apps.py @@ -1,6 +1,6 @@ from django.apps import AppConfig -class HospitalConfig(AppConfig): +class AddressConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' - name = 'hospital' + name = 'Address' diff --git a/Address/migrations/0001_initial.py b/Address/migrations/0001_initial.py new file mode 100644 index 0000000..318dc16 --- /dev/null +++ b/Address/migrations/0001_initial.py @@ -0,0 +1,38 @@ +# Generated by Django 4.0 on 2022-01-03 10:23 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Area', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('area', models.CharField(max_length=100)), + ], + ), + migrations.CreateModel( + name='City', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('city', models.CharField(max_length=100)), + ], + ), + migrations.CreateModel( + name='Address', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('direction', models.TextField(blank=True, null=True)), + ('area', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Address.area')), + ('city', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Address.city')), + ], + ), + ] diff --git a/hospital/migrations/__init__.py b/Address/migrations/__init__.py similarity index 100% rename from hospital/migrations/__init__.py rename to Address/migrations/__init__.py diff --git a/Address/models.py b/Address/models.py new file mode 100644 index 0000000..0e51272 --- /dev/null +++ b/Address/models.py @@ -0,0 +1,27 @@ +from django.db import models + +# Create your models here. + + +class Area(models.Model): + area = models.CharField(max_length=100) + + + def __str__(self): + return self.area +class City(models.Model): + city = models.CharField(max_length=100) + + + def __str__(self): + return self.city + + +class Address(models.Model): + area = models.ForeignKey(Area,on_delete=models.CASCADE) + city = models.ForeignKey(City,on_delete=models.CASCADE) + direction = models.TextField(blank=True,null=True) + + + def __str__(self): + return f'{self.city} - {self.area}' \ No newline at end of file diff --git a/hospital/tests.py b/Address/tests.py similarity index 100% rename from hospital/tests.py rename to Address/tests.py diff --git a/Address/views.py b/Address/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/Address/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8f47e90 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +# Python version +FROM python:3 + +# Set environment variables +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# Set work directory +WORKDIR /code + +# Install dependencies +COPY requirements.txt /code/ +RUN pip install -r requirements.txt + +# Copy project +COPY . /code/ \ No newline at end of file diff --git a/accounts/admin.py b/accounts/admin.py index 8c38f3f..33d94a9 100644 --- a/accounts/admin.py +++ b/accounts/admin.py @@ -1,3 +1,6 @@ + from django.contrib import admin +from django.contrib.auth.admin import UserAdmin +from .models import CustomUser -# Register your models here. +admin.site.register(CustomUser) \ No newline at end of file diff --git a/accounts/migrations/0001_initial.py b/accounts/migrations/0001_initial.py new file mode 100644 index 0000000..83e8d2f --- /dev/null +++ b/accounts/migrations/0001_initial.py @@ -0,0 +1,102 @@ +# Generated by Django 4.0 on 2022-01-03 10:23 + +import django.contrib.auth.models +import django.contrib.auth.validators +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('Address', '0001_initial'), + ('blood_donating', '0001_initial'), + ('auth', '0012_alter_user_first_name_max_length'), + ] + + operations = [ + migrations.CreateModel( + name='CustomUser', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), + ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), + ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), + ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), + ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), + ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), + ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), + ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), + ('phone_number', models.CharField(blank=True, help_text='Contact phone number', max_length=20)), + ('image', models.ImageField(default='../uploads/image/320.png', upload_to='image')), + ('address', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Address.address')), + ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), + ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), + ], + options={ + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + 'abstract': False, + }, + managers=[ + ('objects', django.contrib.auth.models.UserManager()), + ], + ), + migrations.CreateModel( + name='Hospital', + fields=[ + ('customuser_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='accounts.customuser')), + ('website', models.CharField(blank=True, max_length=256, null=True)), + ], + options={ + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + 'abstract': False, + }, + bases=('accounts.customuser',), + managers=[ + ('objects', django.contrib.auth.models.UserManager()), + ], + ), + migrations.CreateModel( + name='Patient', + fields=[ + ('customuser_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='accounts.customuser')), + ('reason', models.TextField()), + ('date_of_birth', models.DateField(blank=True, default='2022-01-01', null=True)), + ('blood_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blood_donating.bloodtype')), + ], + options={ + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + 'abstract': False, + }, + bases=('accounts.customuser',), + managers=[ + ('objects', django.contrib.auth.models.UserManager()), + ], + ), + migrations.CreateModel( + name='Doner', + fields=[ + ('customuser_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='accounts.customuser')), + ('date_of_birth', models.DateField(blank=True, default='2022-01-01', null=True)), + ('chronic_diseases', models.BooleanField(blank=True, default=False, null=True)), + ('blood_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blood_donating.bloodtype')), + ], + options={ + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + 'abstract': False, + }, + bases=('accounts.customuser',), + managers=[ + ('objects', django.contrib.auth.models.UserManager()), + ], + ), + ] diff --git a/accounts/migrations/0002_remove_customuser_address.py b/accounts/migrations/0002_remove_customuser_address.py new file mode 100644 index 0000000..3f58594 --- /dev/null +++ b/accounts/migrations/0002_remove_customuser_address.py @@ -0,0 +1,17 @@ +# Generated by Django 4.0 on 2022-01-03 10:27 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='customuser', + name='address', + ), + ] diff --git a/accounts/migrations/0003_customuser_address.py b/accounts/migrations/0003_customuser_address.py new file mode 100644 index 0000000..4df7bbe --- /dev/null +++ b/accounts/migrations/0003_customuser_address.py @@ -0,0 +1,20 @@ +# Generated by Django 4.0 on 2022-01-03 10:32 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('Address', '0001_initial'), + ('accounts', '0002_remove_customuser_address'), + ] + + operations = [ + migrations.AddField( + model_name='customuser', + name='address', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='Address.address'), + ), + ] diff --git a/accounts/migrations/0004_alter_customuser_image.py b/accounts/migrations/0004_alter_customuser_image.py new file mode 100644 index 0000000..bc40f03 --- /dev/null +++ b/accounts/migrations/0004_alter_customuser_image.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0 on 2022-01-03 10:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0003_customuser_address'), + ] + + operations = [ + migrations.AlterField( + model_name='customuser', + name='image', + field=models.ImageField(blank=True, default='../uploads/image/320.png', null=True, upload_to='image'), + ), + ] diff --git a/accounts/migrations/0005_customuser_roles.py b/accounts/migrations/0005_customuser_roles.py new file mode 100644 index 0000000..018735c --- /dev/null +++ b/accounts/migrations/0005_customuser_roles.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0 on 2022-01-03 12:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0004_alter_customuser_image'), + ] + + operations = [ + migrations.AddField( + model_name='customuser', + name='roles', + field=models.CharField(blank=True, choices=[('Doner', 'Doner'), ('Hospital', 'Hospital'), ('Patient', 'Patient')], max_length=50, null=True), + ), + ] diff --git a/accounts/migrations/0006_remove_doner_blood_type_remove_patient_blood_type.py b/accounts/migrations/0006_remove_doner_blood_type_remove_patient_blood_type.py new file mode 100644 index 0000000..a77ba3d --- /dev/null +++ b/accounts/migrations/0006_remove_doner_blood_type_remove_patient_blood_type.py @@ -0,0 +1,21 @@ +# Generated by Django 4.0 on 2022-01-03 13:24 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0005_customuser_roles'), + ] + + operations = [ + migrations.RemoveField( + model_name='doner', + name='blood_type', + ), + migrations.RemoveField( + model_name='patient', + name='blood_type', + ), + ] diff --git a/accounts/migrations/0007_doner_blood_type_patient_blood_type.py b/accounts/migrations/0007_doner_blood_type_patient_blood_type.py new file mode 100644 index 0000000..8ce80dc --- /dev/null +++ b/accounts/migrations/0007_doner_blood_type_patient_blood_type.py @@ -0,0 +1,27 @@ +# Generated by Django 4.0 on 2022-01-03 13:30 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('blood_donating', '0002_post_donation'), + ('accounts', '0006_remove_doner_blood_type_remove_patient_blood_type'), + ] + + operations = [ + migrations.AddField( + model_name='doner', + name='blood_type', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='blood_donating.bloodtype'), + preserve_default=False, + ), + migrations.AddField( + model_name='patient', + name='blood_type', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='blood_donating.bloodtype'), + preserve_default=False, + ), + ] diff --git a/accounts/migrations/__pycache__/__init__.cpython-39.pyc b/accounts/migrations/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 4628926..0000000 Binary files a/accounts/migrations/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/accounts/models.py b/accounts/models.py index 71a8362..9666554 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -1,3 +1,55 @@ from django.db import models +from django.contrib.auth.models import AbstractUser +from Address.models import Address +from blood_donating.models import BloodType -# Create your models here. +class CustomUser(AbstractUser): + ROLES = ( + + ('Doner', 'Doner'), + ('Hospital', 'Hospital'), + ("Patient","Patient") + + ) + phone_number = models.CharField(max_length=20,blank=True, help_text='Contact phone number') + address = models.ForeignKey(Address,on_delete=models.CASCADE,default=1) + image = models.ImageField(upload_to = 'image',default='../uploads/image/320.png',blank=True,null=True) + roles = models.CharField(max_length=50, choices = ROLES, null=True,blank=True) + def __str__(self): + return self.username + +class Doner(CustomUser): + blood_type = models.ForeignKey(BloodType,on_delete=models.CASCADE) + date_of_birth = models.DateField(blank=True,null=True,default='2022-01-01') + chronic_diseases = models.BooleanField(default=False,blank=True,null=True) + +class Patient(CustomUser): + blood_type = models.ForeignKey(BloodType,on_delete=models.CASCADE) + reason = models.TextField() + date_of_birth = models.DateField(blank=True,null=True,default='2022-01-01') + +class Hospital(CustomUser): + website = models.CharField(max_length=256 ,blank=True,null=True) + + +# class CustomUser(AbstractUser): +# ROLES = ( + +# ('Donater', 'Donater'), +# ('hospital', 'hospital'), +# ("Blood needer","Blood needer") + +# ) + +# date_joined = models.DateField(auto_now_add=True) +# roles = models.CharField(max_length=50, choices = ROLES, null=True,blank=True) +# blood_type = models.CharField(max_length=10 ,blank=True,null=True) +# chronic_diseases = models.BooleanField(default=False,blank=True,null=True) +# image = models.ImageField(upload_to = 'image',default='../uploads/image/320.png') +# date = models.DateField(blank=True,null=True,default='2022-01-01') +# phone_number = models.CharField(max_length=20,blank=True, help_text='Contact phone number') +# location = models.CharField(max_length=50,blank=True,null=True) +# date_of_birth = models.DateField(blank=True,null=True,default='2000-01-01') +# website = models.CharField(max_length=256 ,blank=True,null=True) +# def __str__(self): +# return self.username \ No newline at end of file diff --git a/accounts/serializer.py b/accounts/serializer.py new file mode 100644 index 0000000..27a15d7 --- /dev/null +++ b/accounts/serializer.py @@ -0,0 +1,180 @@ +from django.db.models import fields +from rest_framework import serializers +from .models import CustomUser,Doner,Hospital,Patient +from rest_framework_simplejwt.serializers import TokenObtainPairSerializer + +class AddDonerSerializer(serializers.ModelSerializer): + password = serializers.CharField(write_only=True) + + def create(self, validated_data): + + user = Doner.objects.create_user( + username=validated_data['username'], + password=validated_data['password'], + blood_type = validated_data['blood_type'], + first_name = validated_data['first_name'], + email = validated_data['email'], + image = validated_data['image'], + chronic_diseases = validated_data['chronic_diseases'], + address = validated_data['address'], + roles = validated_data['roles'] + ) + + return user + + class Meta: + model = Doner + fields = ('username','password','first_name','email','blood_type','address','chronic_diseases','image','roles' + ) + +class EditDonerSerializer(serializers.ModelSerializer): + def create(self, validated_data): + + user = Doner.objects.create_user( + username=validated_data['username'], + first_name = validated_data['first_name'], + email = validated_data['email'], + image = validated_data['image'], + chronic_diseases = validated_data['chronic_diseases'], + phone_number = validated_data['phone_number'], + blood_type = validated_data['blood_type'], + ) + + return user + + class Meta: + depth = 2 + model = Doner + fields = ('username','first_name','email','chronic_diseases','image','phone_number','blood_type' + ) + + +class MyTokenObtainPairSerializer(TokenObtainPairSerializer): + def validate(self, attrs): + data = super().validate(attrs) + refresh = self.get_token(self.user) + data['refresh'] = str(refresh) + data['access'] = str(refresh.access_token) + + data['id'] = self.user.id + data['username'] = self.user.username + data['Role'] = self.user.roles + + return data + + + +## hospital serializer + +class AddHospitalUser(serializers.ModelSerializer): + + password = serializers.CharField(write_only=True) + # website = serializers.CharField(write_only=True) + + def create(self, validated_data): + + user = Hospital.objects.create_user( + first_name = validated_data['first_name'], + username=validated_data['username'], + password=validated_data['password'], + website = validated_data['website'], + email = validated_data['email'], + roles = validated_data['roles'] + ) + + return user + + class Meta: + model = Hospital + fields = ( "first_name","username", "password", "website",'email','roles' ) + + +class EditHospitalUser(serializers.ModelSerializer): + + # password = serializers.CharField(write_only=True) + # website = serializers.CharField(write_only=True) + + def create(self, validated_data): + + user = Hospital.objects.create_user( + first_name = validated_data['first_name'], + username=validated_data['username'], + website = validated_data['website'], + image = validated_data['image'], + email = validated_data['email'], + ) + + return user + + class Meta: + model = Hospital + # Tuple of serialized model fields (see link [2]) + fields = ( "first_name","username","website",'email','image' ) + + + +class AddPatientSerializer(serializers.ModelSerializer): + password = serializers.CharField(write_only=True) + + def create(self, validated_data): + + user = Patient.objects.create_user( + username=validated_data['username'], + password=validated_data['password'], + blood_type = validated_data['blood_type'], + first_name = validated_data['first_name'], + email = validated_data['email'], + image = validated_data['image'], + reason = validated_data['reason'], + address = validated_data['address'], + roles = validated_data['roles'] + ) + + return user + + class Meta: + model = Patient + fields = ('username','password','first_name','email','blood_type', 'address', 'reason','image','roles' + ) + +class EditPatientSerializer(serializers.ModelSerializer): + def create(self, validated_data): + + user = Patient.objects.create_user( + username=validated_data['username'], + first_name = validated_data['first_name'], + email = validated_data['email'], + image = validated_data['image'], + reason = validated_data['reason'], + blood_type = validated_data['blood_type'], + phone_number = validated_data['phone_number'], + ) + + return user + + class Meta: + depth = 2 + model = Patient + fields = ('username','first_name','email','reason','image', 'blood_type','phone_number' + ) + +# class BloodSerializer(serializers.ModelSerializer): +# def create(self, validated_data): + +# user = CustomUser.objects.create_user( + +# blood_type = validated_data['blood_type'], +# phone_number = validated_data['phone_number'], +# first_name = validated_data['first_name'], +# email = validated_data['email'], +# image = validated_data['image'], +# location = validated_data['location'], + +# ) + +# return user +# class Meta: +# model = CustomUser +# fields = ('first_name','email','image','location','phone_number' +# ,'blood_type' +# ) diff --git a/accounts/urls.py b/accounts/urls.py new file mode 100644 index 0000000..0311215 --- /dev/null +++ b/accounts/urls.py @@ -0,0 +1,27 @@ +from django.urls import path +from .views import AddListView,DetailAddView,ListView,CustomObtainAuthToken,countview,CreateHospitalUserView,HospitalDetail,HospitalListView,counthospitalview +# from .views import Blood_O_List,Blood_B_List,Blood_A_List,Blood_AB_List +from .views import AddListView +from .views import AddPatientView,ListPatientView,DetailPatientView,countPatientview +urlpatterns = [ + path('donater/signup/',AddListView.as_view(),name= 'add_data'), + path('donater//',DetailAddView.as_view(),name = 'detail_data'), + path("donater/auth/", CustomObtainAuthToken.as_view()), + path('donater/view/',ListView.as_view(),name = 'list_data'), + path('donater/count/',countview.as_view(),name = 'countview'), + + path('hospital/signup/', CreateHospitalUserView.as_view(), name='signup'), + path("hospital//", HospitalDetail.as_view(), name="hospital_detail"), + path("hospital/view/", HospitalListView.as_view(), name="hospital_list"), + path('hospital/count/',counthospitalview.as_view(),name = 'counthospitalview'), + + path('patient/signup/',AddPatientView.as_view(),name= 'add_data'), + path('patient//',DetailPatientView.as_view(),name = 'detail_data'), + path('patient/view/',ListPatientView.as_view(),name = 'list_data'), + path('patient/count/',countPatientview.as_view(),name = 'countview'), + +# path('blood/O/',Blood_O_List.as_view(),name = 'blood_O'), +# path('blood/A/',Blood_A_List.as_view(),name = 'blood_A'), +# path('blood/B/',Blood_B_List.as_view(),name = 'blood_B'), +# path('blood/AB/',Blood_AB_List.as_view(),name = 'blood_AB'), +] \ No newline at end of file diff --git a/accounts/views.py b/accounts/views.py index 91ea44a..d3a8e7f 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,3 +1,144 @@ -from django.shortcuts import render +# from django.shortcuts import render +from rest_framework import generics, permissions +from .serializer import AddDonerSerializer,MyTokenObtainPairSerializer,EditDonerSerializer,EditHospitalUser,AddHospitalUser,AddPatientSerializer,EditPatientSerializer +from .models import Patient,Hospital,Doner +from rest_framework_simplejwt.views import TokenObtainPairView -# Create your views here. +from rest_framework.renderers import JSONRenderer +from rest_framework.response import Response +from rest_framework.views import APIView + + + +class CustomObtainAuthToken(TokenObtainPairView): + serializer_class = MyTokenObtainPairSerializer + +### doner + +class AddListView(generics.CreateAPIView): + serializer_class = AddDonerSerializer + queryset = Doner.objects.all() + permission_classes = [permissions.AllowAny] + + +class DetailAddView(generics.RetrieveUpdateDestroyAPIView): + serializer_class = EditDonerSerializer + queryset = Doner.objects.all() + permission_classes = [permissions.AllowAny] + + + +class ListView(generics.ListAPIView): + serializer_class = EditDonerSerializer + queryset = Doner.objects.all() + + +class countview(APIView): + """ + A view that returns the count of active users. + """ + permission_classes = [permissions.AllowAny] + renderer_classes = [JSONRenderer] + + def get(self, request, format=None): + print(request.data) + user_count = Doner.objects.count() + content = {'user_count': user_count} + return Response(content) + + +## hospital + + +class CreateHospitalUserView(generics.CreateAPIView): + """ + A view that signup hospital. + """ + model = Hospital + permission_classes = [ + permissions.AllowAny # Or anon users can't register + ] + serializer_class = AddHospitalUser + +class HospitalDetail(generics.RetrieveUpdateDestroyAPIView): + """ + A view that returns the detail of hospital + """ + queryset = Hospital.objects.all() + serializer_class = EditHospitalUser + + +class HospitalListView(generics.ListAPIView): + serializer_class = EditHospitalUser + queryset = Hospital.objects.all() + +class counthospitalview(APIView): + """ + A view that returns the count of active users. + """ + permission_classes = [permissions.AllowAny] + renderer_classes = [JSONRenderer] + + def get(self, request, format=None): + print(request.data) + user_count = Hospital.objects.count() + content = {'user_count': user_count} + return Response(content) + + +# Patient + +class AddPatientView(generics.CreateAPIView): + serializer_class = AddPatientSerializer + queryset = Patient.objects.all() + permission_classes = [permissions.AllowAny] + + +class DetailPatientView(generics.RetrieveUpdateDestroyAPIView): + serializer_class = EditPatientSerializer + queryset = Patient.objects.all() + + +class ListPatientView(generics.ListAPIView): + serializer_class = EditPatientSerializer + queryset = Patient.objects.all() + + +class countPatientview(APIView): + """ + A view that returns the count of active users. + """ + permission_classes = [permissions.AllowAny] + renderer_classes = [JSONRenderer] + + def get(self, request, format=None): + print(request.data) + user_count = Patient.objects.count() + content = {'user_count': user_count} + return Response(content) + + + + +# ## filter Blood +# class Blood_O_List(generics.ListAPIView): +# typeBlood=['O+','O-'] +# serializer_class = BloodSerializer +# queryset = CustomUser.objects.filter(blood_type__in=typeBlood) +# permission_classes = [permissions.AllowAny] + +# class Blood_A_List(generics.ListAPIView): +# typeBlood=['O+','O-','A+','A-'] +# serializer_class = BloodSerializer +# queryset = CustomUser.objects.filter(blood_type__in=typeBlood) +# permission_classes = [permissions.AllowAny] +# class Blood_B_List(generics.ListAPIView): +# typeBlood=['O+','O-','B+','B-'] +# serializer_class = BloodSerializer +# queryset = CustomUser.objects.filter(blood_type__in=typeBlood) +# permission_classes = [permissions.AllowAny] +# class Blood_AB_List(generics.ListAPIView): +# typeBlood=['O+','O-','B+','B-','A+','A-','AB+','AB-'] +# serializer_class = BloodSerializer +# queryset = CustomUser.objects.filter(blood_type__in=typeBlood) +# permission_classes = [permissions.AllowAny] \ No newline at end of file diff --git a/api_tester.py b/api_tester.py new file mode 100644 index 0000000..6172c6b --- /dev/null +++ b/api_tester.py @@ -0,0 +1,4 @@ +from hospital.models import customUser + +for p in customUser.objects.raw('SELECT * FROM hospital_customUser'): + print(p) \ No newline at end of file diff --git a/blood_donating/admin.py b/blood_donating/admin.py index 8c38f3f..cee4606 100644 --- a/blood_donating/admin.py +++ b/blood_donating/admin.py @@ -1,3 +1,5 @@ from django.contrib import admin - +from .models import BloodType # Register your models here. + +admin.site.register(BloodType) \ No newline at end of file diff --git a/blood_donating/migrations/0001_initial.py b/blood_donating/migrations/0001_initial.py new file mode 100644 index 0000000..80912bf --- /dev/null +++ b/blood_donating/migrations/0001_initial.py @@ -0,0 +1,22 @@ +# Generated by Django 4.0 on 2022-01-03 10:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='BloodType', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('blood_type', models.CharField(max_length=5)), + ('description', models.TextField()), + ], + ), + ] diff --git a/blood_donating/migrations/0002_post_donation.py b/blood_donating/migrations/0002_post_donation.py new file mode 100644 index 0000000..dd9405f --- /dev/null +++ b/blood_donating/migrations/0002_post_donation.py @@ -0,0 +1,38 @@ +# Generated by Django 4.0 on 2022-01-03 13:24 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0006_remove_doner_blood_type_remove_patient_blood_type'), + ('blood_donating', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Post', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=256)), + ('text', models.TextField()), + ('time', models.DateTimeField(auto_now_add=True)), + ('publish', models.BooleanField()), + ('patient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accounts.customuser', to_field='username')), + ], + ), + migrations.CreateModel( + name='Donation', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('time', models.DateTimeField(auto_now_add=True)), + ('notes', models.TextField()), + ('available', models.BooleanField()), + ('doner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accounts.doner')), + ('hospital', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accounts.hospital')), + ('patient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accounts.patient')), + ], + ), + ] diff --git a/blood_donating/migrations/__pycache__/__init__.cpython-39.pyc b/blood_donating/migrations/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 0d31494..0000000 Binary files a/blood_donating/migrations/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/blood_donating/models.py b/blood_donating/models.py index 71a8362..152025d 100644 --- a/blood_donating/models.py +++ b/blood_donating/models.py @@ -1,3 +1,46 @@ from django.db import models -# Create your models here. +class BloodType(models.Model): + blood_type=models.CharField(max_length=5) + description = models.TextField() + + def __str__(self): + return self.blood_type + +from accounts.models import CustomUser, Doner, Patient, Hospital +class Donation(models.Model): + doner = models.ForeignKey(Doner,on_delete=models.CASCADE) + hospital = models.ForeignKey(Hospital,on_delete=models.CASCADE) + patient = models.ForeignKey(Patient,on_delete=models.CASCADE) + time = models.DateTimeField(auto_now_add=True, blank=True) + notes = models.TextField() + available = models.BooleanField() + + +class Post(models.Model): + patient = models.ForeignKey(CustomUser,to_field='username',on_delete=models.CASCADE) + title = models.CharField(max_length=256) + text = models.TextField() + # blood_type = models.CharField(max_length=10) + time = models.DateTimeField(auto_now_add=True, blank=True) + publish = models.BooleanField() + + def __str__(self) : + return f"{self.patient} {self.title}" + + +''' +Donation: +- doner -->fk +- timestamp (DateTimeField) +- notes +- hospital +- available Booleand +- Patient --> FK +Post: + title + text + datetime + patient + publish Boolean +''' \ No newline at end of file diff --git a/blood_donating/serializer.py b/blood_donating/serializer.py new file mode 100644 index 0000000..ec12d24 --- /dev/null +++ b/blood_donating/serializer.py @@ -0,0 +1,14 @@ +from .models import BloodType, Post +from rest_framework import serializers + + +class PostSerializer(serializers.ModelSerializer): + class Meta: + model = Post + fields = ["id",'patient', 'title',"time","text","publish"] + +class BloodSerilaizer(serializers.ModelSerializer): + class Meta: + model = BloodType + fields = ['blood_type'] + diff --git a/blood_donating/urls.py b/blood_donating/urls.py new file mode 100644 index 0000000..eda930e --- /dev/null +++ b/blood_donating/urls.py @@ -0,0 +1,8 @@ +from django.urls import path +from .views import PostViewSet , GetViewSet,UpdateDestroyViewSet, EditBlood +urlpatterns = [ + path('add/', PostViewSet.as_view(), name='add_post'), + path('show/',GetViewSet.as_view(), name= "show-post"), + path('update-delete//',UpdateDestroyViewSet.as_view(),name= "update-delete-post"), + path('update-blood//',EditBlood.as_view(),name= "update-delete-post") +] \ No newline at end of file diff --git a/blood_donating/views.py b/blood_donating/views.py index 91ea44a..3eb2200 100644 --- a/blood_donating/views.py +++ b/blood_donating/views.py @@ -1,3 +1,38 @@ from django.shortcuts import render # Create your views here. +from django.shortcuts import render +from rest_framework.generics import CreateAPIView , ListAPIView,RetrieveUpdateDestroyAPIView +from .models import BloodType, Post +from .serializer import PostSerializer, BloodSerilaizer +from rest_framework import permissions + +# Create your views here. + +class PostViewSet(CreateAPIView): + """ + API endpoint that allows users to be viewed or edited. + """ + serializer_class = PostSerializer + permission_classes = [permissions.AllowAny] + +class GetViewSet(ListAPIView): + """ + API endpoint that allows users to be viewed or edited. + """ + serializer_class = PostSerializer + queryset =Post.objects.all().order_by("-time") + # permission_classes = [permissions.IsAuthenticated] + +class UpdateDestroyViewSet(RetrieveUpdateDestroyAPIView): + serializer_class = PostSerializer + queryset =Post.objects.all().order_by("-time") + # permission_classes = [permissions.IsAuthenticated] + +class EditBlood(RetrieveUpdateDestroyAPIView): + """ + API endpoint that allows users to be viewed or edited. + """ + serializer_class = BloodSerilaizer + permission_classes = [permissions.AllowAny] + queryset =BloodType.objects.all() diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..8f570c0 Binary files /dev/null and b/db.sqlite3 differ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..19c83e0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '4' + +services: + web: + build: . + command: gunicorn cookie_project.wsgi:application --bind 0.0.0.0:8000 --workers 4 + volumes: + - .:/code + ports: + - 8000:8000 \ No newline at end of file diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000..8f2bca6 --- /dev/null +++ b/heroku.yml @@ -0,0 +1,7 @@ +build: + docker: + web: Dockerfile +release: + image: web +run: + web: gunicorn cookie_project.wsgi --workers 4 \ No newline at end of file diff --git a/hospital/admin.py b/hospital/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/hospital/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/hospital/forms.py b/hospital/forms.py deleted file mode 100644 index 70028c0..0000000 --- a/hospital/forms.py +++ /dev/null @@ -1,43 +0,0 @@ -from django import forms -from django.contrib.auth.models import User -from django.contrib.auth.forms import UserCreationForm -from django.core.exceptions import ValidationError - - -class HospitalCreateForm(UserCreationForm): - username = forms.CharField(label='username', min_length=5, max_length=150) - email = forms.EmailField(label='email') - password1 = forms.CharField(label='password', widget=forms.PasswordInput) - password2 = forms.CharField(label='Confirm password', widget=forms.PasswordInput) - website = forms.CharField(label='website', max_length=256) - image = forms.ImageField() - - def username_clean(self): - username = self.cleaned_data['username'].lower() - new = User.objects.filter(username = username) - if new.count(): - raise ValidationError("User Already Exist") - return username - - def email_clean(self): - email = self.cleaned_data['email'].lower() - new = User.objects.filter(email=email) - if new.count(): - raise ValidationError(" Email Already Exist") - return email - - def clean_password2(self): - password1 = self.cleaned_data['password1'] - password2 = self.cleaned_data['password2'] - - if password1 and password2 and password1 != password2: - raise ValidationError("Password don't match") - return password2 - - def save(self, commit = True): - user = User.objects.create_user( - self.cleaned_data['username'], - self.cleaned_data['email'], - self.cleaned_data['password1'] - ) - return user \ No newline at end of file diff --git a/hospital/migrations/0001_initial.py b/hospital/migrations/0001_initial.py deleted file mode 100644 index f67d21c..0000000 --- a/hospital/migrations/0001_initial.py +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by Django 4.0 on 2021-12-30 11:36 - -import django.contrib.auth.models -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('auth', '0012_alter_user_first_name_max_length'), - ] - - operations = [ - migrations.CreateModel( - name='customUser', - fields=[ - ('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='auth.user')), - ('website', models.CharField(max_length=256)), - ], - options={ - 'verbose_name': 'user', - 'verbose_name_plural': 'users', - 'abstract': False, - }, - bases=('auth.user',), - managers=[ - ('objects', django.contrib.auth.models.UserManager()), - ], - ), - ] diff --git a/hospital/migrations/0002_customuser_image.py b/hospital/migrations/0002_customuser_image.py deleted file mode 100644 index 4aa1acd..0000000 --- a/hospital/migrations/0002_customuser_image.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.0 on 2021-12-30 11:59 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('hospital', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='customuser', - name='image', - field=models.ImageField(default='default.png', upload_to=''), - ), - ] diff --git a/hospital/migrations/__pycache__/0001_initial.cpython-39.pyc b/hospital/migrations/__pycache__/0001_initial.cpython-39.pyc deleted file mode 100644 index 61bfd28..0000000 Binary files a/hospital/migrations/__pycache__/0001_initial.cpython-39.pyc and /dev/null differ diff --git a/hospital/migrations/__pycache__/0002_customuser_image.cpython-39.pyc b/hospital/migrations/__pycache__/0002_customuser_image.cpython-39.pyc deleted file mode 100644 index bed21d1..0000000 Binary files a/hospital/migrations/__pycache__/0002_customuser_image.cpython-39.pyc and /dev/null differ diff --git a/hospital/migrations/__pycache__/__init__.cpython-39.pyc b/hospital/migrations/__pycache__/__init__.cpython-39.pyc deleted file mode 100644 index 7e30419..0000000 Binary files a/hospital/migrations/__pycache__/__init__.cpython-39.pyc and /dev/null differ diff --git a/hospital/models.py b/hospital/models.py deleted file mode 100644 index c1e3d72..0000000 --- a/hospital/models.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.db import models -from django.contrib.auth.models import User -# Create your models here. - -class customUser (User): - website = models.CharField(max_length=256) - image = models.ImageField(default='default.png') \ No newline at end of file diff --git a/hospital/serializers.py b/hospital/serializers.py deleted file mode 100644 index 0af7e24..0000000 --- a/hospital/serializers.py +++ /dev/null @@ -1,37 +0,0 @@ -from rest_framework import serializers -from django.contrib.auth import get_user_model # If used custom user model -from .models import customUser -from rest_framework_simplejwt.serializers import TokenObtainPairSerializer - -class UserSerializer(serializers.ModelSerializer): - - password = serializers.CharField(write_only=True) - # website = serializers.CharField(write_only=True) - - def create(self, validated_data): - - user = customUser.objects.create_user( - username=validated_data['username'], - password=validated_data['password'], - website = validated_data['website'], - ) - - return user - - class Meta: - model = customUser - # Tuple of serialized model fields (see link [2]) - fields = ( "id", "username", "password", "website", "image" ) - - -class MyTokenObtainPairSerializer(TokenObtainPairSerializer): - def validate(self, attrs): - data = super().validate(attrs) - refresh = self.get_token(self.user) - data['refresh'] = str(refresh) - data['access'] = str(refresh.access_token) - - # Add extra responses here - data['id'] = self.user.id - data['username'] = self.user.username - return data \ No newline at end of file diff --git a/hospital/urls.py b/hospital/urls.py deleted file mode 100644 index 3c54004..0000000 --- a/hospital/urls.py +++ /dev/null @@ -1,10 +0,0 @@ -# accounts/urls.py -from django.urls import path -from .views import CreateUserView, HospitalDetail -from .views import CustomObtainAuthToken - -urlpatterns = [ - path('signup/', CreateUserView.as_view(), name='signup'), - path("/", HospitalDetail.as_view(), name="hospital_detail"), - path('authenticate/', CustomObtainAuthToken.as_view()) -] \ No newline at end of file diff --git a/hospital/views.py b/hospital/views.py deleted file mode 100644 index 7cefef0..0000000 --- a/hospital/views.py +++ /dev/null @@ -1,27 +0,0 @@ -from rest_framework import permissions -from rest_framework.generics import CreateAPIView, RetrieveAPIView -from django.contrib.auth import get_user_model # If used custom user model -from .models import customUser -from .serializers import UserSerializer -from rest_framework_simplejwt.views import TokenObtainPairView -from .serializers import MyTokenObtainPairSerializer - - - - -class CustomObtainAuthToken(TokenObtainPairView): - serializer_class = MyTokenObtainPairSerializer - -class CreateUserView(CreateAPIView): - model = get_user_model() - permission_classes = [ - permissions.AllowAny # Or anon users can't register - ] - serializer_class = UserSerializer - -class HospitalDetail(RetrieveAPIView): - queryset = customUser.objects.all() - serializer_class = UserSerializer - permission_classes = [ - permissions.AllowAny # Or anon users can't register - ] \ No newline at end of file diff --git a/lifeshare/settings.py b/lifeshare/settings.py index 80507c6..9a43c56 100644 --- a/lifeshare/settings.py +++ b/lifeshare/settings.py @@ -41,7 +41,7 @@ ALLOWED_HOSTS = tuple(env.list("ALLOWED_HOSTS")) # Application definition - +CORS_ORIGIN_ALLOW_ALL=True INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', @@ -57,7 +57,7 @@ ## local 'blood_donating', 'accounts', - 'hospital' + 'Address' ] MIDDLEWARE = [ @@ -133,7 +133,7 @@ LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' +TIME_ZONE = "Asia/Amman" USE_I18N = True @@ -143,17 +143,30 @@ # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.0/howto/static-files/ -STATIC_URL = "/static/" -STATIC_ROOT = BASE_DIR / "staticfiles" +STATIC_URL = 'static/' + +STATIC_ROOT = BASE_DIR / 'staticfiles' +STATICFILES_DIRS = [ + BASE_DIR / 'static' +] + # Default primary key field type # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' +AUTH_USER_MODEL = 'accounts.CustomUser' REST_FRAMEWORK = { - - 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'DEFAULT_PERMISSION_CLASSES': [ + 'rest_framework.permissions.AllowAny', + ], + 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework_simplejwt.authentication.JWTAuthentication', - ) + 'rest_framework.authentication.BasicAuthentication', + # 'rest_framework.authentication.SessionAuthentication' + ], } + +MEDIA_ROOT = BASE_DIR / 'uploads' +MEDIA_URL = '/files/' diff --git a/lifeshare/urls.py b/lifeshare/urls.py index 2a82988..ca78d09 100644 --- a/lifeshare/urls.py +++ b/lifeshare/urls.py @@ -20,10 +20,16 @@ TokenObtainPairView, TokenRefreshView, ) +from django.conf.urls.static import static +from django.conf import settings + urlpatterns = [ path('admin/', admin.site.urls), - path('hospital/', include('hospital.urls')), # new - path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'), - path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'), -] + path('accounts/',include('accounts.urls')), + path('api/token/', jwt_views.TokenObtainPairView.as_view(), name='token_obtain_pair'), + path('api/token/refresh/', jwt_views.TokenRefreshView.as_view(), name='token_refresh'), + path('blood/', include('blood_donating.urls')), +]+static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT) + + diff --git a/poetry.lock b/poetry.lock index f6ebea5..3918d60 100644 --- a/poetry.lock +++ b/poetry.lock @@ -50,6 +50,17 @@ develop = ["coverage[toml] (>=5.0a4)", "pytest (>=4.6.11)", "furo (>=2021.8.17b4 docs = ["furo (>=2021.8.17b43,<2021.9.0)", "sphinx (>=3.5.0)", "sphinx-notfound-page"] testing = ["coverage[toml] (>=5.0a4)", "pytest (>=4.6.11)"] +[[package]] +name = "django-phone-field" +version = "1.8.1" +description = "Lightweight model and form field for phone numbers in Django" +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +Django = ">=1.10" + [[package]] name = "djangorestframework" version = "3.13.1" @@ -164,7 +175,8 @@ brotli = ["brotli"] [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "fd1305541462c7660350a864411aae83daeea3275e5aa4c95f81d0abc8bae2ff" +content-hash = "2e4554106aa28e22d929a0dfcc8a39a99afd9dd4b95a87f7b8ab2f02b0ab54f9" + [metadata.files] asgiref = [ @@ -183,6 +195,10 @@ django-environ = [ {file = "django-environ-0.8.1.tar.gz", hash = "sha256:6f0bc902b43891656b20486938cba0861dc62892784a44919170719572a534cb"}, {file = "django_environ-0.8.1-py2.py3-none-any.whl", hash = "sha256:42593bee519a527602a467c7b682aee1a051c2597f98c45f4f4f44169ecdb6e5"}, ] +django-phone-field = [ + {file = "django-phone-field-1.8.1.tar.gz", hash = "sha256:db63af60fc3a3c66b9faa7e72bb7972cd1518299f2e93d68dd95d8df6214f7ed"}, + {file = "django_phone_field-1.8.1-py3-none-any.whl", hash = "sha256:407e74b65e8f7dd14d0a0aa89e277516d57ad6a09ce992cdd94e15b1624b9961"}, +] djangorestframework = [ {file = "djangorestframework-3.13.1-py3-none-any.whl", hash = "sha256:24c4bf58ed7e85d1fe4ba250ab2da926d263cd57d64b03e8dcef0ac683f8b1aa"}, {file = "djangorestframework-3.13.1.tar.gz", hash = "sha256:0c33407ce23acc68eca2a6e46424b008c9c02eceb8cf18581921d0092bc1f2ee"}, diff --git a/pyproject.toml b/pyproject.toml index 087a03d..8843f9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ gunicorn = "^20.1.0" whitenoise = "^5.3.0" django-cors-headers = "^3.10.1" djangorestframework-simplejwt = "^5.0.0" +django-phone-field = "^1.8.1" Pillow = "^8.4.0" [tool.poetry.dev-dependencies] diff --git a/templates/base.html b/templates/base.html deleted file mode 100644 index ec94dd0..0000000 --- a/templates/base.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - {% block title %}Django Auth Tutorial{% endblock %} - - -
- {% block content %} - {% endblock %} -
- - \ No newline at end of file diff --git a/templates/registration/signup.html b/templates/registration/signup.html deleted file mode 100644 index 404a990..0000000 --- a/templates/registration/signup.html +++ /dev/null @@ -1,13 +0,0 @@ - -{% extends 'base.html' %} - -{% block title %}Sign Up{% endblock %} - -{% block content %} -

Sign up

-
- {% csrf_token %} - {{ form.as_p }} - -
-{% endblock %} \ No newline at end of file diff --git a/hospital/default.png b/uploads/image/320.png similarity index 100% rename from hospital/default.png rename to uploads/image/320.png diff --git a/uploads/image/320_DfqzxOI.png b/uploads/image/320_DfqzxOI.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_DfqzxOI.png differ diff --git a/uploads/image/320_Duc31Ko.png b/uploads/image/320_Duc31Ko.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_Duc31Ko.png differ diff --git a/uploads/image/320_Fvgq4Kl.png b/uploads/image/320_Fvgq4Kl.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_Fvgq4Kl.png differ diff --git a/uploads/image/320_I4VrIsn.png b/uploads/image/320_I4VrIsn.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_I4VrIsn.png differ diff --git a/uploads/image/320_JymAues.png b/uploads/image/320_JymAues.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_JymAues.png differ diff --git a/uploads/image/320_QJS9VTv.png b/uploads/image/320_QJS9VTv.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_QJS9VTv.png differ diff --git a/uploads/image/320_QsVquT0.png b/uploads/image/320_QsVquT0.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_QsVquT0.png differ diff --git a/uploads/image/320_UG32aiY.png b/uploads/image/320_UG32aiY.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_UG32aiY.png differ diff --git a/uploads/image/320_WXsd4LA.png b/uploads/image/320_WXsd4LA.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_WXsd4LA.png differ diff --git a/uploads/image/320_YSpvUsB.png b/uploads/image/320_YSpvUsB.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_YSpvUsB.png differ diff --git a/uploads/image/320_egeWdpS.png b/uploads/image/320_egeWdpS.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_egeWdpS.png differ diff --git a/uploads/image/320_fMWruLo.png b/uploads/image/320_fMWruLo.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_fMWruLo.png differ diff --git a/uploads/image/320_fqeKtJe.png b/uploads/image/320_fqeKtJe.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_fqeKtJe.png differ diff --git a/uploads/image/320_g7og1cA.png b/uploads/image/320_g7og1cA.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_g7og1cA.png differ diff --git a/uploads/image/320_hF1OkIF.png b/uploads/image/320_hF1OkIF.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_hF1OkIF.png differ diff --git a/uploads/image/320_t12ehEA.png b/uploads/image/320_t12ehEA.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_t12ehEA.png differ diff --git a/uploads/image/320_uWBuf1z.png b/uploads/image/320_uWBuf1z.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_uWBuf1z.png differ diff --git a/uploads/image/320_xCc4w4n.png b/uploads/image/320_xCc4w4n.png new file mode 100644 index 0000000..c402c36 Binary files /dev/null and b/uploads/image/320_xCc4w4n.png differ diff --git a/uploads/image/code39.jpg b/uploads/image/code39.jpg new file mode 100644 index 0000000..d661f27 Binary files /dev/null and b/uploads/image/code39.jpg differ diff --git a/uploads/image/code39_Gd4Ghe8.jpg b/uploads/image/code39_Gd4Ghe8.jpg new file mode 100644 index 0000000..d661f27 Binary files /dev/null and b/uploads/image/code39_Gd4Ghe8.jpg differ diff --git a/uploads/image/code39_hZiG2Of.jpg b/uploads/image/code39_hZiG2Of.jpg new file mode 100644 index 0000000..d661f27 Binary files /dev/null and b/uploads/image/code39_hZiG2Of.jpg differ diff --git a/uploads/image/man-walking-dog.jpg b/uploads/image/man-walking-dog.jpg new file mode 100644 index 0000000..f643118 Binary files /dev/null and b/uploads/image/man-walking-dog.jpg differ diff --git a/uploads/image/man-walking-dog_FLf2YHH.jpg b/uploads/image/man-walking-dog_FLf2YHH.jpg new file mode 100644 index 0000000..f643118 Binary files /dev/null and b/uploads/image/man-walking-dog_FLf2YHH.jpg differ diff --git a/uploads/image/man-walking-dog_GGMN16y.jpg b/uploads/image/man-walking-dog_GGMN16y.jpg new file mode 100644 index 0000000..f643118 Binary files /dev/null and b/uploads/image/man-walking-dog_GGMN16y.jpg differ diff --git a/uploads/image/man-walking-dog_So6Jirb.jpg b/uploads/image/man-walking-dog_So6Jirb.jpg new file mode 100644 index 0000000..f643118 Binary files /dev/null and b/uploads/image/man-walking-dog_So6Jirb.jpg differ diff --git a/uploads/image/man-walking-dog_hMUvM5v.jpg b/uploads/image/man-walking-dog_hMUvM5v.jpg new file mode 100644 index 0000000..f643118 Binary files /dev/null and b/uploads/image/man-walking-dog_hMUvM5v.jpg differ diff --git a/uploads/image/pp1.jpg b/uploads/image/pp1.jpg new file mode 100644 index 0000000..710a603 Binary files /dev/null and b/uploads/image/pp1.jpg differ diff --git a/uploads/image/pp1_dR7VZ8y.jpg b/uploads/image/pp1_dR7VZ8y.jpg new file mode 100644 index 0000000..710a603 Binary files /dev/null and b/uploads/image/pp1_dR7VZ8y.jpg differ diff --git a/uploads/image/project.png b/uploads/image/project.png new file mode 100644 index 0000000..989ad5a Binary files /dev/null and b/uploads/image/project.png differ diff --git a/uploads/image/project4.png b/uploads/image/project4.png new file mode 100644 index 0000000..97c2286 Binary files /dev/null and b/uploads/image/project4.png differ diff --git a/uploads/image/project401.png b/uploads/image/project401.png new file mode 100644 index 0000000..c424054 Binary files /dev/null and b/uploads/image/project401.png differ diff --git a/uploads/image/project4_KSixa58.png b/uploads/image/project4_KSixa58.png new file mode 100644 index 0000000..97c2286 Binary files /dev/null and b/uploads/image/project4_KSixa58.png differ diff --git a/uploads/image/project4_lymYvKO.png b/uploads/image/project4_lymYvKO.png new file mode 100644 index 0000000..97c2286 Binary files /dev/null and b/uploads/image/project4_lymYvKO.png differ diff --git a/uploads/image/whiteboardyahia.jpg b/uploads/image/whiteboardyahia.jpg new file mode 100644 index 0000000..4e12d0d Binary files /dev/null and b/uploads/image/whiteboardyahia.jpg differ diff --git a/uploads/image/yaseen.PNG b/uploads/image/yaseen.PNG new file mode 100644 index 0000000..8828bf6 Binary files /dev/null and b/uploads/image/yaseen.PNG differ diff --git a/uploads/image/yaseen_112jspG.PNG b/uploads/image/yaseen_112jspG.PNG new file mode 100644 index 0000000..8828bf6 Binary files /dev/null and b/uploads/image/yaseen_112jspG.PNG differ diff --git a/uploads/image/yaseen_DLfciZC.PNG b/uploads/image/yaseen_DLfciZC.PNG new file mode 100644 index 0000000..8828bf6 Binary files /dev/null and b/uploads/image/yaseen_DLfciZC.PNG differ diff --git a/views.py b/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.