Skip to content

Commit 78510b7

Browse files
author
koladev
committed
🚧 add menu
1 parent ee542d3 commit 78510b7

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

RestaurantCore/settings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@
3939
"django.contrib.staticfiles",
4040

4141
#third apps
42-
"rest_framework"
42+
"rest_framework",
43+
44+
# installed apps
45+
46+
"menu"
4347
]
4448

4549
MIDDLEWARE = [

RestaurantCore/urls.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@
1515
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
1616
"""
1717
from django.contrib import admin
18-
from django.urls import path
18+
from django.urls import path, include
19+
20+
from routers import router
1921

2022
urlpatterns = [
2123
path("admin/", admin.site.urls),
24+
25+
path('api/', include((router.urls, 'core_api'), namespace='core_api')),
26+
2227
]

menu/migrations/0001_initial.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Generated by Django 4.2.6 on 2023-10-25 20:52
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
initial = True
8+
9+
dependencies = []
10+
11+
operations = [
12+
migrations.CreateModel(
13+
name="Menu",
14+
fields=[
15+
(
16+
"id",
17+
models.BigAutoField(
18+
auto_created=True,
19+
primary_key=True,
20+
serialize=False,
21+
verbose_name="ID",
22+
),
23+
),
24+
("name", models.CharField(max_length=255)),
25+
("price", models.FloatField()),
26+
("created", models.DateTimeField(auto_now_add=True)),
27+
("updated", models.DateTimeField(auto_now=True)),
28+
],
29+
),
30+
]

routers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from rest_framework import routers
2+
3+
from menu.viewsets import MenuViewSet
4+
5+
router = routers.SimpleRouter()
6+
7+
router.register(r'menu', MenuViewSet, basename="menu")
8+
9+
urlpatterns = router.urls

0 commit comments

Comments
 (0)