Skip to content

Commit 3cadae7

Browse files
committed
initial commit
0 parents  commit 3cadae7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1447
-0
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
env
2+
**/*.pyc
3+
**/__pycache__
4+
db.sqlite3
5+
node_modules
6+
build
7+
static
8+
package-lock.json
9+
venv

.idea/.gitignore

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/django-react-boilerplate-master.iml

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.vscode/settings.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"python.pythonPath": "${workspaceFolder}/env/bin/python3",
3+
"editor.formatOnSave": true,
4+
"python.linting.pep8Enabled": true,
5+
"python.linting.pylintPath": "pylint",
6+
"python.linting.pylintArgs": ["--load-plugins", "pylint_django"],
7+
"python.linting.pylintEnabled": true,
8+
"python.venvPath": "${workspaceFolder}/env/bin/python3",
9+
"python.linting.pep8Args": ["--ignore=E501"],
10+
"files.exclude": {
11+
"**/*.pyc": true
12+
}
13+
}

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Backend development workflow
2+
3+
```json
4+
virtualenv env
5+
source env/bin/activate
6+
pip install -r requirements.txt
7+
python manage.py runserver
8+
```
9+
10+
## Frontend development workflow
11+
12+
```json
13+
npm i
14+
npm start
15+
```
16+
17+
## For deploying
18+
19+
```json
20+
npm run build
21+
```

api/__init__.py

Whitespace-only changes.

api/admin.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from django.contrib import admin
2+
from .models import *
3+
4+
# Register your models here.
5+
admin.site.register(Service)
6+
admin.site.register(Customer)
7+
admin.site.register(Appointment)
8+
admin.site.register(Book_status)
9+
admin.site.register(User_status)
10+
admin.site.register(Booking_Paid)

api/apps.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ApiConfig(AppConfig):
5+
name = 'api'

api/migrations/0001_initial.py

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Generated by Django 2.2.3 on 2020-06-19 10:25
2+
3+
from django.conf import settings
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
initial = True
11+
12+
dependencies = [
13+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14+
]
15+
16+
operations = [
17+
migrations.CreateModel(
18+
name='Book_status',
19+
fields=[
20+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21+
('status', models.CharField(max_length=100, null=True)),
22+
],
23+
),
24+
migrations.CreateModel(
25+
name='Booking_Paid',
26+
fields=[
27+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
28+
('paid', models.CharField(max_length=100, null=True)),
29+
],
30+
),
31+
migrations.CreateModel(
32+
name='Service',
33+
fields=[
34+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
35+
('name', models.CharField(max_length=100, null=True)),
36+
('cost', models.IntegerField(null=True)),
37+
('image', models.FileField(null=True, upload_to='')),
38+
],
39+
),
40+
migrations.CreateModel(
41+
name='User_status',
42+
fields=[
43+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
44+
('status', models.CharField(max_length=100, null=True)),
45+
],
46+
),
47+
migrations.CreateModel(
48+
name='Customer',
49+
fields=[
50+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
51+
('mobile', models.IntegerField(null=True)),
52+
('id_card_no', models.CharField(max_length=100, null=True)),
53+
('gender', models.CharField(max_length=10, null=True)),
54+
('image', models.FileField(null=True, upload_to='')),
55+
('status', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='api.User_status')),
56+
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
57+
],
58+
),
59+
migrations.CreateModel(
60+
name='Appointment',
61+
fields=[
62+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
63+
('date1', models.DateField(null=True)),
64+
('time1', models.DateField(null=True)),
65+
('customer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='api.Customer')),
66+
('paid', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='api.Booking_Paid')),
67+
('service', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='api.Service')),
68+
('status', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='api.Book_status')),
69+
],
70+
),
71+
]

api/migrations/__init__.py

Whitespace-only changes.

api/models.py

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
from django.db import models
2+
from django.contrib.auth.models import User
3+
4+
5+
# Create your models here.
6+
from django.db.models.signals import post_save
7+
8+
9+
class User_status(models.Model):
10+
status = models.CharField(max_length=100, null=True)
11+
12+
def __str__(self):
13+
return self.status
14+
15+
16+
class Customer(models.Model):
17+
user = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
18+
status = models.ForeignKey(User_status, on_delete=models.CASCADE, null=True)
19+
mobile = models.IntegerField(null=True)
20+
id_card_no = models.CharField(max_length=100, null=True)
21+
gender = models.CharField(max_length=10, null=True)
22+
image = models.FileField(null=True)
23+
24+
def __str__(self):
25+
return self.user.username
26+
27+
def create_customer(sender, instance, created, **kwargs):
28+
if created:
29+
Customer.objects.create(user=instance)
30+
31+
post_save.connect(create_customer, sender=User)
32+
33+
34+
class Service(models.Model):
35+
name = models.CharField(max_length=100, null=True)
36+
cost = models.IntegerField(null=True)
37+
image = models.FileField(null=True)
38+
39+
def __str__(self):
40+
return self.name
41+
42+
43+
class Book_status(models.Model):
44+
status = models.CharField(max_length=100, null=True)
45+
46+
def __str__(self):
47+
return self.status
48+
49+
50+
class Booking_Paid(models.Model):
51+
paid = models.CharField(max_length=100, null=True)
52+
53+
def __str__(self):
54+
return self.paid
55+
56+
57+
class Appointment(models.Model):
58+
service = models.ForeignKey(Service, on_delete=models.CASCADE, null=True)
59+
customer = models.ForeignKey(Customer, on_delete=models.CASCADE, null=True)
60+
status = models.ForeignKey(Book_status, on_delete=models.CASCADE, null=True)
61+
paid = models.ForeignKey(Booking_Paid, on_delete=models.CASCADE, null=True)
62+
date1 = models.DateField(null=True)
63+
time1 = models.DateField(null=True)
64+
65+
def __str__(self):
66+
return self.customer.user.username + "" + self.service.name

api/tests.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

api/views.py

Whitespace-only changes.

home/__init__.py

Whitespace-only changes.

home/settings/__init__.py

Whitespace-only changes.

home/settings/base.py

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import os
2+
3+
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
4+
SECRET_KEY = '-05sgp9!deq=q1nltm@^^2cc+v29i(tyybv3v2t77qi66czazj'
5+
DEBUG = True
6+
ALLOWED_HOSTS = []
7+
8+
INSTALLED_APPS = [
9+
'django.contrib.admin',
10+
'django.contrib.auth',
11+
'django.contrib.contenttypes',
12+
'django.contrib.sessions',
13+
'django.contrib.messages',
14+
'django.contrib.staticfiles',
15+
16+
'django.contrib.sites',
17+
'allauth',
18+
'allauth.account',
19+
'allauth.socialaccount',
20+
'corsheaders',
21+
'rest_auth',
22+
'rest_auth.registration',
23+
'rest_framework',
24+
'rest_framework.authtoken',
25+
26+
'api'
27+
]
28+
29+
MIDDLEWARE = [
30+
'corsheaders.middleware.CorsMiddleware',
31+
'django.middleware.security.SecurityMiddleware',
32+
'django.contrib.sessions.middleware.SessionMiddleware',
33+
'django.middleware.common.CommonMiddleware',
34+
'django.middleware.csrf.CsrfViewMiddleware',
35+
'django.contrib.auth.middleware.AuthenticationMiddleware',
36+
'django.contrib.messages.middleware.MessageMiddleware',
37+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
38+
]
39+
40+
ROOT_URLCONF = 'home.urls'
41+
42+
TEMPLATES = [
43+
{
44+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
45+
'DIRS': [os.path.join(BASE_DIR, 'build')],
46+
'APP_DIRS': True,
47+
'OPTIONS': {
48+
'context_processors': [
49+
'django.template.context_processors.debug',
50+
'django.template.context_processors.request',
51+
'django.contrib.auth.context_processors.auth',
52+
'django.contrib.messages.context_processors.messages',
53+
],
54+
},
55+
},
56+
]
57+
58+
LANGUAGE_CODE = 'en-us'
59+
TIME_ZONE = 'UTC'
60+
USE_I18N = True
61+
USE_L10N = True
62+
USE_TZ = True
63+
64+
STATIC_URL = '/static/'
65+
MEDIA_URL = '/media/'
66+
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'build/static')]
67+
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
68+
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
69+
SITE_ID = 1
70+
71+
REST_FRAMEWORK = {
72+
'DEFAULT_PERMISSION_CLASSES': (
73+
'rest_framework.permissions.AllowAny',
74+
),
75+
'DEFAULT_AUTHENTICATION_CLASSES': (
76+
'rest_framework.authentication.TokenAuthentication',
77+
),
78+
}
79+
80+
ACCOUNT_EMAIL_REQUIRED = False
81+
ACCOUNT_AUTHENTICATION_METHOD = 'username'
82+
ACCOUNT_EMAIL_VERIFICATION = 'none'

home/settings/dev.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'''Use this for development'''
2+
3+
from .base import *
4+
5+
ALLOWED_HOSTS += ['127.0.0.1']
6+
DEBUG = True
7+
8+
WSGI_APPLICATION = 'home.wsgi.dev.application'
9+
10+
DATABASES = {
11+
'default': {
12+
'ENGINE': 'django.db.backends.sqlite3',
13+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
14+
}
15+
}
16+
17+
CORS_ORIGIN_WHITELIST = (
18+
'http://localhost:3000',
19+
)

home/settings/prod.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'''Use this for production'''
2+
3+
from .base import *
4+
5+
DEBUG = False
6+
ALLOWED_HOSTS += ['http://domain.com']
7+
WSGI_APPLICATION = 'home.wsgi.prod.application'
8+
9+
DATABASES = {
10+
'default': {
11+
'ENGINE': 'django.db.backends.postgresql_psycopg2',
12+
'NAME': 'db_name',
13+
'USER': 'db_user',
14+
'PASSWORD': 'db_password',
15+
'HOST': 'localhost',
16+
'PORT': '',
17+
}
18+
}
19+
20+
AUTH_PASSWORD_VALIDATORS = [
21+
{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'},
22+
{'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'},
23+
{'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'},
24+
{'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'},
25+
]
26+
27+
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

0 commit comments

Comments
 (0)