Skip to content

Commit

Permalink
Improving and Integrated with Jinja πŸ†
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammadali-Akbarov committed Aug 27, 2023
1 parent 56f8b51 commit 6e8493e
Show file tree
Hide file tree
Showing 43 changed files with 1,270 additions and 3 deletions.
2 changes: 2 additions & 0 deletions apps/shop/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from django.contrib import admin

from shop.models import Product
from shop.models import CustomOrderModel


admin.site.register(Product)
admin.site.register(CustomOrderModel)
2 changes: 1 addition & 1 deletion apps/shop/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.4 on 2023-08-24 07:24
# Generated by Django 4.2.4 on 2023-08-24 08:20

from django.db import migrations, models
import django.db.models.deletion
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.4 on 2023-08-25 15:46

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('shop', '0001_initial'),
]

operations = [
migrations.RemoveField(
model_name='customordermodel',
name='amount',
),
migrations.RemoveField(
model_name='customordermodel',
name='created_at',
),
migrations.RemoveField(
model_name='customordermodel',
name='updated_at',
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.4 on 2023-08-26 07:15

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('shop', '0002_remove_customordermodel_amount_and_more'),
]

operations = [
migrations.RemoveField(
model_name='customordermodel',
name='user_id',
),
migrations.AddField(
model_name='customordermodel',
name='user',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
preserve_default=False,
),
]
23 changes: 23 additions & 0 deletions apps/shop/migrations/0004_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.4 on 2023-08-26 15:36

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('payme', '0003_alter_merchattransactionsmodel_options'),
('shop', '0003_remove_customordermodel_user_id_and_more'),
]

operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', models.TextField()),
('items', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='payme.item')),
],
),
]
12 changes: 10 additions & 2 deletions apps/shop/models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
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_id = models.IntegerField(null=True, blank=True) # other fields...
user = models.ForeignKey(User, on_delete=models.CASCADE) # other fields...

def __str__(self):
return f"ORDER ID: {self.id} - AMOUNT: {self.amount}"
formatted_number = '{:,}'.format(self.amount)
return f"ORDER ID: {self.id} - AMOUNT: {formatted_number} UZS"


class Product(models.Model):
items = models.ForeignKey(Item, on_delete=models.CASCADE)
image = models.TextField()
65 changes: 65 additions & 0 deletions apps/shop/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!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>

<!-- header section starts -->
{% include "sections/header.html" %}
<!-- header section ends -->

<!-- home section starts -->
{% include "sections/home.html" %}
<!-- home section ends -->

<!-- about section starts -->
{% include "sections/about.html" %}
<!-- about section ends -->

<!-- food section starts -->
{% include "sections/food.html" %}
<!-- food section ends -->

<!-- order section starts -->
{% include "sections/order.html" %}
<!-- order section ends -->

<!--footer section starts -->
{% include "sections/footer.html" %}
<!--footer section ends -->

<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>
30 changes: 30 additions & 0 deletions apps/shop/templates/sections/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% load static %}
<!-- about section starts -->
<section class="about" id="about">
<div class="image">
<img src="{% static 'images/about-img.png' %}" alt="">
</div>

<div class="content">
<h3 class="title">welcome to our restaurant</h3>
<p>We have a very old family tradition: once a month we pay a visit to the restaurant for a family dinner. It is
a great chance to spend the evening out of our usual setting. What is more, it is a good chance to have fun
and get away from the routine we get tired of and enjoy some time with the family.</p>

<div class="icons-container">
<div class="icons">
<img src="{% static 'images/about-icon-1.png' %}" alt="">
<h3>quality food</h3>
</div>
<div class="icons">
<img src="{% static 'images/about-icon-2.png' %}" alt="">
<h3>food & drinks</h3>
</div>
<div class="icons">
<img src="{% static 'images/about-icon-3.png' %}" alt="">
<h3>expert chefs</h3>
</div>
</div>
</div>
</section>
<!-- about section ends -->
41 changes: 41 additions & 0 deletions apps/shop/templates/sections/food.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{% load static %}
<!-- food section starts -->
<section class="food" id="food">
<div class="heading">
<span>popular dishes</span>
<h3>our delicious food</h3>
</div>
<div class="swiper food-slider">
<div class="swiper-wrapper">
<div class="swiper-slide slide" data-name="food-12">
<img src="{% static 'media/food-img-1.png' %}" alt="">
<h3>Barbecue</h3>
<div class="price">$49.990</div>
<a href="index.html#order" class="btn">buy now</a>
</div>

<div class="swiper-slide slide" data-name="food-13">
<img src="{% static 'media/food-img-2.png' %}" alt="">
<h3>Steak</h3>
<div class="price">$61.990</div>
<a href="index.html#order" class="btn">buy now</a>
</div>

<div class="swiper-slide slide" data-name="food-14">
<img src="{% static 'media/food-img-3.png' %}" alt="">
<h3>Crispy fried chicken</h3>
<div class="price">$30.000</div>
<a href="index.html#order" class="btn">buy now</a>
</div>

<div class="swiper-slide slide" data-name="food-15">
<img src="{% static 'media/food-img-5.png' %}" alt="">
<h3>Taco</h3>
<div class="price">$63.000</div>
<a href="index.html#order" class="btn">buy now</a>
</div>
</div>
<div class="swiper-pagination"></div>
</div>
</section>
<!-- food section ends -->
44 changes: 44 additions & 0 deletions apps/shop/templates/sections/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!-- footer section starts -->

<section class="footer">

<div class="icons-container">

<div class="icons">
<i class="fas fa-clock"></i>
<h3>opening hours</h3>
<p>24h</p>
</div>

<div class="icons">
<i class="fas fa-phone"></i>
<h3>phone</h3>
<p>+123-456-7890</p>
<p>+111-222-3333</p>
</div>

<div class="icons">
<i class="fas fa-envelope"></i>
<h3>email</h3>
<p>[email protected]</p>
<p>[email protected]</p>
</div>

<div class="icons">
<i class="fas fa-map"></i>
<h3>address</h3>
<p>Tashkent, Uzbekistan - 400104</p>
</div>

</div>

<div class="share">
<a href="https://t.me/JapanFoods" class="fab fa-telegram"></a>
<a href="https://twitter.com/foods_japan" class="fab fa-twitter"></a>
</div>

<div class="credit"> Β© 2022 Amazing Foods </div>

</section>

<!-- footer section ends -->
18 changes: 18 additions & 0 deletions apps/shop/templates/sections/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- header section starts -->
<section class="header">

<a href="index.html" class="logo"> <i class="fas fa-utensils"></i> food. </a>

<nav class="navbar">
<a href="index.html#home">home</a>
<a href="index.html#about">about</a>
<a href="index.html#food">food</a>
<a href="index.html#gallery">gallery</a>
<a href="index.html#menu">menu</a>
<a href="index.html#order">order</a>
<a href="index.html#blogs">blogs</a>
</nav>

<div id="menu-btn" class="fas fa-bars"></div>
</section>
<!-- header section ends -->
39 changes: 39 additions & 0 deletions apps/shop/templates/sections/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% load static %}
<!-- home section starts -->
<section class="home" id="home">
<div class="swiper home-slider">
<div class="swiper-wrapper">

<div class="swiper-slide slide" style="background: url('{% static 'images/home-slide-1.jpg' %}') no-repeat;">
<div class="content">
<span>outstanding food</span>
<h3>delicious cooking</h3>
<a href="index.html#" class="btn">get started</a>
</div>
</div>

<div class="swiper-slide slide" style="background: url('{% static 'images/home-slide-2.jpg' %}') no-repeat;">
<div class="content">
<span>outstanding food</span>
<h3>morning moment</h3>
<a href="index.html#" class="btn">get started</a>
</div>
</div>

<div class="swiper-slide slide" style="background: url('{% static 'images/home-slide-3.jpg' %}') no-repeat;">
<div class="content">
<span>outstanding food</span>
<h3>authentic kitchen</h3>
<a href="index.html#" class="btn">get started</a>
</div>
</div>

</div>

<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>

</div>

</section>
<!-- home section ends -->
Loading

0 comments on commit 6e8493e

Please sign in to comment.