Skip to content

Commit 0d15b22

Browse files
author
muhammadjabborov
committed
fix : database
1 parent 6c37ea2 commit 0d15b22

File tree

201 files changed

+76
-42359
lines changed

Some content is hidden

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

201 files changed

+76
-42359
lines changed

apps/user/migrations/0001_initial.py

+69-186
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 4.1.2 on 2022-11-07 01:42
1+
# Generated by Django 4.1.2 on 2023-04-25 13:51
22

33
import django.core.validators
44
from django.db import migrations, models
@@ -9,233 +9,116 @@ class Migration(migrations.Migration):
99

1010
initial = True
1111

12-
dependencies = []
12+
dependencies = [
13+
]
1314

1415
operations = [
1516
migrations.CreateModel(
16-
name="CourseCategory",
17+
name='CourseCategory',
1718
fields=[
18-
(
19-
"id",
20-
models.BigAutoField(
21-
auto_created=True,
22-
primary_key=True,
23-
serialize=False,
24-
verbose_name="ID",
25-
),
26-
),
27-
("created_at", models.DateTimeField(auto_now_add=True)),
28-
("updated_at", models.DateTimeField(auto_now=True)),
29-
("name", models.CharField(max_length=255)),
30-
("slug", models.SlugField(unique=True)),
31-
("photo", models.ImageField(upload_to="icons/")),
19+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20+
('created_at', models.DateTimeField(auto_now_add=True)),
21+
('updated_at', models.DateTimeField(auto_now=True)),
22+
('name', models.CharField(max_length=255)),
23+
('slug', models.SlugField(unique=True)),
24+
('photo', models.ImageField(upload_to='icons/')),
3225
],
3326
options={
34-
"db_table": "categories",
27+
'db_table': 'categories',
3528
},
3629
),
3730
migrations.CreateModel(
38-
name="CourseComplain",
31+
name='CourseComplain',
3932
fields=[
40-
(
41-
"id",
42-
models.BigAutoField(
43-
auto_created=True,
44-
primary_key=True,
45-
serialize=False,
46-
verbose_name="ID",
47-
),
48-
),
49-
("created_at", models.DateTimeField(auto_now_add=True)),
50-
("updated_at", models.DateTimeField(auto_now=True)),
51-
("first_name", models.CharField(max_length=255)),
52-
("phone_number", models.CharField(max_length=25)),
53-
("description", models.CharField(max_length=522)),
33+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
34+
('created_at', models.DateTimeField(auto_now_add=True)),
35+
('updated_at', models.DateTimeField(auto_now=True)),
36+
('first_name', models.CharField(max_length=255)),
37+
('phone_number', models.CharField(max_length=25)),
38+
('description', models.CharField(max_length=522)),
5439
],
5540
options={
56-
"db_table": "complains",
41+
'db_table': 'complains',
5742
},
5843
),
5944
migrations.CreateModel(
60-
name="CourseNew",
45+
name='CourseNew',
6146
fields=[
62-
(
63-
"id",
64-
models.BigAutoField(
65-
auto_created=True,
66-
primary_key=True,
67-
serialize=False,
68-
verbose_name="ID",
69-
),
70-
),
71-
("created_at", models.DateTimeField(auto_now_add=True)),
72-
("updated_at", models.DateTimeField(auto_now=True)),
73-
("image", models.ImageField(upload_to="icons/")),
74-
("title", models.CharField(max_length=255)),
75-
("description", models.CharField(max_length=522)),
47+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
48+
('created_at', models.DateTimeField(auto_now_add=True)),
49+
('updated_at', models.DateTimeField(auto_now=True)),
50+
('image', models.ImageField(upload_to='icons/')),
51+
('title', models.CharField(max_length=255)),
52+
('description', models.CharField(max_length=522)),
7653
],
7754
options={
78-
"db_table": "news",
55+
'db_table': 'news',
7956
},
8057
),
8158
migrations.CreateModel(
82-
name="Teacher",
59+
name='Teacher',
8360
fields=[
84-
(
85-
"id",
86-
models.BigAutoField(
87-
auto_created=True,
88-
primary_key=True,
89-
serialize=False,
90-
verbose_name="ID",
91-
),
92-
),
93-
("created_at", models.DateTimeField(auto_now_add=True)),
94-
("updated_at", models.DateTimeField(auto_now=True)),
95-
("full_name", models.CharField(max_length=255)),
96-
("image", models.ImageField(upload_to="icons/")),
97-
(
98-
"rating",
99-
models.FloatField(
100-
validators=[
101-
django.core.validators.MaxValueValidator(5, "Should be 5"),
102-
django.core.validators.MinValueValidator(1, "Should be 1"),
103-
]
104-
),
105-
),
106-
("description", models.CharField(max_length=522)),
107-
("url_video", models.CharField(max_length=255)),
108-
(
109-
"direction",
110-
models.ForeignKey(
111-
on_delete=django.db.models.deletion.CASCADE,
112-
to="user.coursecategory",
113-
),
114-
),
61+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
62+
('created_at', models.DateTimeField(auto_now_add=True)),
63+
('updated_at', models.DateTimeField(auto_now=True)),
64+
('full_name', models.CharField(max_length=255)),
65+
('image', models.ImageField(upload_to='icons/')),
66+
('rating', models.FloatField(validators=[django.core.validators.MaxValueValidator(5, 'Should be 5'), django.core.validators.MinValueValidator(1, 'Should be 1')])),
67+
('description', models.CharField(max_length=522)),
68+
('url_video', models.URLField()),
69+
('direction', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.coursecategory')),
11570
],
11671
options={
117-
"db_table": "teachers",
72+
'db_table': 'teachers',
11873
},
11974
),
12075
migrations.CreateModel(
121-
name="Student",
76+
name='Student',
12277
fields=[
123-
(
124-
"id",
125-
models.BigAutoField(
126-
auto_created=True,
127-
primary_key=True,
128-
serialize=False,
129-
verbose_name="ID",
130-
),
131-
),
132-
("created_at", models.DateTimeField(auto_now_add=True)),
133-
("updated_at", models.DateTimeField(auto_now=True)),
134-
("full_name", models.CharField(max_length=255)),
135-
("image", models.ImageField(upload_to="icons/")),
136-
("description", models.CharField(max_length=522)),
137-
(
138-
"course",
139-
models.ForeignKey(
140-
on_delete=django.db.models.deletion.CASCADE,
141-
to="user.coursecategory",
142-
),
143-
),
144-
(
145-
"teacher",
146-
models.ForeignKey(
147-
on_delete=django.db.models.deletion.CASCADE, to="user.teacher"
148-
),
149-
),
78+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
79+
('created_at', models.DateTimeField(auto_now_add=True)),
80+
('updated_at', models.DateTimeField(auto_now=True)),
81+
('full_name', models.CharField(max_length=255)),
82+
('image', models.ImageField(upload_to='icons/')),
83+
('description', models.CharField(max_length=522)),
84+
('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.coursecategory')),
85+
('teacher', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.teacher')),
15086
],
15187
options={
152-
"db_table": "students",
88+
'db_table': 'students',
15389
},
15490
),
15591
migrations.CreateModel(
156-
name="Customer",
92+
name='Customer',
15793
fields=[
158-
(
159-
"id",
160-
models.BigAutoField(
161-
auto_created=True,
162-
primary_key=True,
163-
serialize=False,
164-
verbose_name="ID",
165-
),
166-
),
167-
("created_at", models.DateTimeField(auto_now_add=True)),
168-
("updated_at", models.DateTimeField(auto_now=True)),
169-
("first_name", models.CharField(max_length=255)),
170-
("phone_number", models.CharField(max_length=25)),
171-
(
172-
"status",
173-
models.CharField(
174-
choices=[
175-
("Kutilyapti", "Inactive"),
176-
("Qabul qilindi", "Active"),
177-
("Qabdul qilinmadi", "Reject"),
178-
("Keyinroqqa qo'yildi", "Postponed"),
179-
],
180-
default="Kutilyapti",
181-
max_length=25,
182-
),
183-
),
184-
(
185-
"course",
186-
models.ForeignKey(
187-
on_delete=django.db.models.deletion.CASCADE,
188-
to="user.coursecategory",
189-
),
190-
),
94+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
95+
('created_at', models.DateTimeField(auto_now_add=True)),
96+
('updated_at', models.DateTimeField(auto_now=True)),
97+
('first_name', models.CharField(max_length=255)),
98+
('phone_number', models.CharField(max_length=25)),
99+
('status', models.CharField(choices=[('Kutilyapti', 'Inactive'), ('Qabul qilindi', 'Active'), ('Qabul qilinmadi', 'Reject'), ("Keyinroqqa qo'yildi", 'Postponed')], default='Kutilyapti', max_length=25)),
100+
('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.coursecategory')),
191101
],
192102
options={
193-
"db_table": "customers",
103+
'db_table': 'customers',
194104
},
195105
),
196106
migrations.CreateModel(
197-
name="Course",
107+
name='Course',
198108
fields=[
199-
(
200-
"id",
201-
models.BigAutoField(
202-
auto_created=True,
203-
primary_key=True,
204-
serialize=False,
205-
verbose_name="ID",
206-
),
207-
),
208-
("created_at", models.DateTimeField(auto_now_add=True)),
209-
("updated_at", models.DateTimeField(auto_now=True)),
210-
("image", models.ImageField(upload_to="icons/")),
211-
("title", models.CharField(max_length=255)),
212-
("duration", models.IntegerField()),
213-
(
214-
"rating",
215-
models.FloatField(
216-
validators=[
217-
django.core.validators.MaxValueValidator(5, "Should be 5"),
218-
django.core.validators.MinValueValidator(1, "Should be 1"),
219-
]
220-
),
221-
),
222-
("description", models.CharField(max_length=522)),
223-
(
224-
"category",
225-
models.ForeignKey(
226-
on_delete=django.db.models.deletion.CASCADE,
227-
to="user.coursecategory",
228-
),
229-
),
230-
(
231-
"full_name",
232-
models.ForeignKey(
233-
on_delete=django.db.models.deletion.CASCADE, to="user.teacher"
234-
),
235-
),
109+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
110+
('created_at', models.DateTimeField(auto_now_add=True)),
111+
('updated_at', models.DateTimeField(auto_now=True)),
112+
('image', models.ImageField(upload_to='icons/')),
113+
('title', models.CharField(max_length=255)),
114+
('duration', models.IntegerField()),
115+
('rating', models.FloatField(validators=[django.core.validators.MaxValueValidator(5, 'Should be 5'), django.core.validators.MinValueValidator(1, 'Should be 1')])),
116+
('description', models.CharField(max_length=522)),
117+
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.coursecategory')),
118+
('full_name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.teacher')),
236119
],
237120
options={
238-
"db_table": "courses",
121+
'db_table': 'courses',
239122
},
240123
),
241124
]

apps/user/migrations/0002_alter_teacher_url_video.py

-18
This file was deleted.

apps/user/migrations/0002_remove_coursecategory_parent.py

-17
This file was deleted.

root/settings.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from pathlib import Path
1111
import sys
1212
import os
13-
from root.jazzmin_conf import *
13+
from root.jazzmin_conf import * #noqa
1414

1515
# Build paths inside the project like this: BASE_DIR / 'subdir'.
1616
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -86,16 +86,11 @@
8686

8787
DATABASES = {
8888
'default': {
89-
'ENGINE': 'django.db.backends.postgresql',
90-
'NAME': 'habib_db',
91-
'USER': 'postgres',
92-
'PASSWORD': 'muhammad',
93-
'HOST': 'localhost',
94-
'PORT': 5432
89+
'ENGINE': 'django.db.backends.sqlite3',
90+
'NAME': 'db.sqlite'
9591
}
9692
}
9793

98-
9994
AUTH_PASSWORD_VALIDATORS = [
10095
{
10196
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
@@ -187,7 +182,10 @@
187182
LOGIN_URL = '/api/v1/user/login/'
188183

189184
STATIC_URL = '/static/'
190-
STATIC_ROOT = os.path.join(BASE_DIR / 'static')
185+
STATICFILES_DIRS = [
186+
BASE_DIR / 'static'
187+
]
188+
# STATIC_ROOT = os.path.join(BASE_DIR / 'static')
191189

192190
MEDIA_URL = '/media/'
193191
MEDIA_ROOT = os.path.join(BASE_DIR / 'media')

0 commit comments

Comments
 (0)