-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
262 additions
and
104 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
apps/shop/migrations/0005_remove_customordermodel_user_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.2.4 on 2023-08-27 03:53 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('shop', '0004_product'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='customordermodel', | ||
name='user', | ||
), | ||
migrations.AddField( | ||
model_name='customordermodel', | ||
name='phone_number', | ||
field=models.CharField(default=1, max_length=24), | ||
preserve_default=False, | ||
), | ||
] |
26 changes: 26 additions & 0 deletions
26
apps/shop/migrations/0006_customordermodel_full_name_customordermodel_product.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.4 on 2023-08-27 06:51 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('shop', '0005_remove_customordermodel_user_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='customordermodel', | ||
name='full_name', | ||
field=models.CharField(default=1, max_length=40), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='customordermodel', | ||
name='product', | ||
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='shop.product'), | ||
preserve_default=False, | ||
), | ||
] |
17 changes: 17 additions & 0 deletions
17
apps/shop/migrations/0007_remove_customordermodel_product.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.4 on 2023-08-27 07:01 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('shop', '0006_customordermodel_full_name_customordermodel_product'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='customordermodel', | ||
name='product', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.4 on 2023-08-27 16:40 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('shop', '0007_remove_customordermodel_product'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='customordermodel', | ||
name='wants_at', | ||
field=models.DateTimeField(blank=True, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import User | ||
|
||
from payme.models import Item | ||
from payme.models import BaseOrder | ||
|
||
|
||
class CustomOrderModel(BaseOrder): | ||
user = models.ForeignKey(User, on_delete=models.CASCADE) # other fields... | ||
class Product(models.Model): | ||
items = models.ForeignKey(Item, on_delete=models.CASCADE) | ||
image = models.TextField() | ||
|
||
def __str__(self): | ||
formatted_number = '{:,}'.format(self.amount) | ||
return f"ORDER ID: {self.id} - AMOUNT: {formatted_number} UZS" | ||
amount = self.items.price / 100 | ||
formatted_number = '{:,}'.format(amount) | ||
return f"{self.items.title} - {formatted_number} UZS" | ||
|
||
|
||
class Product(models.Model): | ||
items = models.ForeignKey(Item, on_delete=models.CASCADE) | ||
image = models.TextField() | ||
class CustomOrderModel(BaseOrder): | ||
# user = models.ForeignKey(User, on_delete=models.CASCADE) | ||
full_name = models.CharField(max_length=40) | ||
phone_number = models.CharField(max_length=24) | ||
wants_at = models.DateTimeField(null=True, blank=True) | ||
|
||
def __str__(self): | ||
amount = self.amount / 100 | ||
formatted_number = '{:,}'.format(amount) | ||
return f"ORDER ID: {self.id} - AMOUNT: {formatted_number} UZS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!DOCTYPE html> | ||
{% load static %} | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="shortcut icon" href="{% static 'images/logo.png' %}" type="image/x-icon" /> | ||
<title>Welcome to our Restaurant</title> | ||
|
||
<!-- font awesome cdn link --> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> | ||
|
||
<link rel="stylesheet" href="https://unpkg.com/swiper@7/swiper-bundle.min.css" /> | ||
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery-js/1.4.0/css/lightgallery.min.css"> | ||
|
||
<link rel="stylesheet" href="{% static 'css/style.css' %}"> | ||
<!-- custom css file link --> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
{% block content %} | ||
|
||
{% endblock content %} | ||
<script> | ||
function addToCart(productId) { | ||
// Use localStorage to store the productId | ||
localStorage.setItem('cartItemId', productId); | ||
console.log('Added to cart:', productId); | ||
} | ||
</script> | ||
|
||
<script src="https://unpkg.com/swiper@7/swiper-bundle.min.js"></script> | ||
|
||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lightgallery-js/1.4.0/js/lightgallery.min.js"></script> | ||
|
||
<!-- custom js file link --> | ||
<script src="{% static 'js/script.js' %}"></script> | ||
|
||
<script> | ||
lightGallery(document.querySelector('.gallery .gallery-container')); | ||
</script> | ||
|
||
</body> | ||
|
||
</html> | ||
|
||
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% extends "base.html" %} | ||
|
||
{% load static %} | ||
|
||
{% block content %} | ||
{% include "sections/header.html" %} | ||
{% include "sections/order.html" %} | ||
{% include "sections/footer.html" %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
from django.urls import path | ||
|
||
from apps.shop.views.buy import buy_view | ||
from apps.shop.views.home import home_view | ||
from apps.shop.views.pay_link import GeneratePayLinkAPIView | ||
|
||
|
||
urlpatterns = [ | ||
path('', home_view, name='home'), | ||
path('<str:pk>/buy/', buy_view, name='buy'), | ||
path('pay-link/', GeneratePayLinkAPIView.as_view(), name='generate-pay-link') | ||
] |
Oops, something went wrong.