Skip to content

Commit 158e56f

Browse files
authored
Merge pull request larymak#210 from SATHIYASEELAN2021/contribute
Added E-commerce cart
2 parents 3459af4 + 09d88be commit 158e56f

File tree

74 files changed

+1471
-0
lines changed

Some content is hidden

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

74 files changed

+1471
-0
lines changed

OTHERS/MyFavouriteCart/main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This is a sample Python script.
2+
3+
# Press Shift+F10 to execute it or replace it with your code.
4+
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
5+
6+
7+
def print_hi(name):
8+
# Use a breakpoint in the code line below to debug your script.
9+
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
10+
11+
12+
# Press the green button in the gutter to run the script.
13+
if __name__ == '__main__':
14+
print_hi('PyCharm')
15+
16+
# See PyCharm help at https://www.jetbrains.com/help/pycharm/

OTHERS/MyFavouriteCart/mfc/blog/__init__.py

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.
4+
from .models import Blogpost
5+
6+
admin.site.register(Blogpost)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class BlogConfig(AppConfig):
5+
name = 'blog'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Generated by Django 3.1.5 on 2021-04-15 14:06
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
initial = True
9+
10+
dependencies = [
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name='Blogpost',
16+
fields=[
17+
('post_id', models.AutoField(primary_key=True, serialize=False)),
18+
('title', models.CharField(max_length=50)),
19+
('head0', models.CharField(default='', max_length=500)),
20+
('head1', models.CharField(default='', max_length=500)),
21+
('head2', models.CharField(default='', max_length=500)),
22+
('pub_date', models.DateField()),
23+
('thumbnail', models.ImageField(default='', upload_to='shop/images')),
24+
],
25+
),
26+
]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated by Django 3.1.5 on 2021-04-15 14:14
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('blog', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='blogpost',
15+
name='chead0',
16+
field=models.CharField(default='', max_length=5000),
17+
),
18+
migrations.AddField(
19+
model_name='blogpost',
20+
name='chead1',
21+
field=models.CharField(default='', max_length=5000),
22+
),
23+
migrations.AddField(
24+
model_name='blogpost',
25+
name='chead2',
26+
field=models.CharField(default='', max_length=5000),
27+
),
28+
]

OTHERS/MyFavouriteCart/mfc/blog/migrations/__init__.py

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from django.db import models
2+
3+
# Create your models here.
4+
class Blogpost(models.Model):
5+
post_id=models.AutoField(primary_key=True)
6+
title=models.CharField(max_length=50)
7+
head0=models.CharField(max_length=500, default="")
8+
chead0=models.CharField(max_length=5000, default="")
9+
head1=models.CharField(max_length=500, default="")
10+
chead1=models.CharField(max_length=5000, default="")
11+
head2=models.CharField(max_length=500, default="")
12+
chead2=models.CharField(max_length=5000, default="")
13+
pub_date=models.DateField()
14+
thumbnail= models.ImageField(upload_to="shop/images", default="")
15+
16+
def __str__(self):
17+
return self.title
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is my static file in blog
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<!-- Required meta tags -->
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
8+
<!-- Bootstrap CSS -->
9+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
10+
11+
<title>{% block title%} {% endblock %}</title>
12+
<style>
13+
{% block css %} {% endblock %}
14+
</style>
15+
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v3.2"></script>
16+
</head>
17+
<body>
18+
19+
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
20+
<a class="navbar-brand" href="/shop">My Favourite Cart</a>
21+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
22+
<span class="navbar-toggler-icon"></span>
23+
</button>
24+
25+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
26+
<ul class="navbar-nav mr-auto">
27+
<li class="nav-item">
28+
<a class="nav-link" href="/shop">Home <span class="sr-only">(current)</span></a>
29+
</li>
30+
<li class="nav-item">
31+
<a class="nav-link" href="/shop/about">About Us</a>
32+
</li>
33+
34+
<li class="nav-item">
35+
<a class="nav-link" href="/shop/tracker">Tracker</a>
36+
</li>
37+
38+
<li class="nav-item active">
39+
<a class="nav-link" href="/blog">Blog</a>
40+
</li>
41+
42+
<li class="nav-item">
43+
<a class="nav-link" href="/shop/contact">Contact Us</a>
44+
</li>
45+
46+
47+
</ul>
48+
<form class="form-inline my-2 my-lg-0">
49+
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
50+
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
51+
</form>
52+
<button type="button" class="btn btn-secondary mx-2" id="popcart" data-container="body" data-toggle="popover" data-placement="bottom" data-html="true" data-content="Vivamus
53+
sagittis lacus vel augue laoreet rutrum faucibus.">
54+
55+
56+
Cart(<span id="cart">0</span>)
57+
</button>
58+
</div>
59+
</nav>
60+
{% block body %} {% endblock %}
61+
62+
<!-- Optional JavaScript -->
63+
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
64+
<script src="https://code.jquery.com/jquery-3.3.1.js"
65+
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
66+
crossorigin="anonymous"></script>
67+
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
68+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
69+
{% block js %} {% endblock %}
70+
</body>
71+
</html>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{% extends 'blog/basic.html' %}
2+
3+
{% block body %}
4+
<div class="container">
5+
<div class="row mt-4">
6+
<div class="col-md-8 blog-main">
7+
<h3 class="font-italic">
8+
{{post.title}}
9+
</h3>
10+
11+
<div class="blog-post">
12+
<h2 class="blog-post-title">{{post.heading0}}</h2>
13+
<p class="blog-post-meta">January 1, 2014 by <a href="#">Mark</a></p>
14+
<div class="fb-like" data-href="http://127.0.0.1:8000/blog/blogpost/{{post.post_id}}" data-layout="standard" data-action="like" data-size="large" data-show-faces="false" data-share="true"></div><br>
15+
16+
<p>{{post.chead0}}</p>
17+
18+
19+
<h2>{{post.head1}}</h2>
20+
<p>{{post.chead1}}</p>
21+
<h2>{{post.head2}}</h2>
22+
<p>{{post.chead2}}</p>
23+
<div class="fb-comments" data-href="http://127.0.0.1:8000/blog/blogpost/{{post.post_id}}" data-numposts="5"></div>
24+
25+
26+
</div><!-- /.blog-post -->
27+
28+
29+
30+
31+
</div><!-- /.blog-main -->
32+
33+
<aside class="col-md-4 blog-sidebar">
34+
<div class="p-4 mb-3 bg-light rounded">
35+
<h4 class="font-italic">About</h4>
36+
<p class="mb-0">My Favourite Cart <em>started out as a small project and is now</em> the fastest growing e-commerce stores of all times in india and abroad.</p>
37+
<div class="my-3 fb-share-button" data-href="http://127.0.0.1:8000/blog/blogpost/{{post.post_id}}" data-layout="button_count" data-size="large"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2F127.0.0.1%3A8000%2Fblog%2Fblogpost%2F4&src=sdkpreparse" class="fb-xfbml-parse-ignore">Share</a></div>
38+
</div>
39+
40+
41+
42+
<div class="p-4">
43+
<h4 class="font-italic">Elsewhere</h4>
44+
<ol class="list-unstyled">
45+
<li><a href="#">GitHub</a></li>
46+
<li><a href="#">Twitter</a></li>
47+
<li><a href="#">Facebook</a></li>
48+
</ol>
49+
</div>
50+
</aside><!-- /.blog-sidebar -->
51+
52+
</div>
53+
</div>
54+
55+
{% endblock %}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{%extends 'blog/basic.html'%}
2+
{%block body%}
3+
<div class="container mt-3">
4+
<div class="row my-2">
5+
{% for item in myposts %}
6+
<div class="col-md-6">
7+
<div class="row no-gutters border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-250 position-relative">
8+
<div class="col p-4 d-flex flex-column position-static">
9+
<strong class="d-inline-block mb-2 text-primary"> {{item.head0}} </strong>
10+
<h3 class="mb-0">{{item.title}}</h3>
11+
<div class="mb-1 text-muted">Nov 12</div>
12+
<p class="card-text mb-auto">{{item.head1}}</p>
13+
<a href="blogpost/{{item.post_id}}" class="stretched-link">Continue reading</a>
14+
</div>
15+
<div class="col-auto d-none d-lg-block">
16+
<img src="/media/{{item.thumbnail}}" class="bd-placeholder-img" width="200" height="250" aria-label="Placeholder: Thumbnail">
17+
</div>
18+
</div>
19+
</div>
20+
{% if forloop.counter|divisibleby:2%}
21+
</div>
22+
<div class="row my-2">
23+
{%endif%}
24+
{%endfor%}</div>
25+
</div>
26+
{%endblock%}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from django.urls import path
2+
from . import views
3+
4+
urlpatterns = [
5+
path("", views.index, name="blogHome"),
6+
path("blogpost/<int:id>", views.blogpost, name="blogHome")
7+
]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from django.shortcuts import render
2+
from .models import Blogpost
3+
# Create your views.py here.
4+
from django.http import HttpResponse
5+
6+
def index(request):
7+
myposts = Blogpost.objects.all()
8+
print(myposts)
9+
return render(request, 'blog/index.html',
10+
{'myposts': myposts})
11+
12+
def blogpost(request, id):
13+
post = Blogpost.objects.filter(post_id = id)[0]
14+
print(post)
15+
return render(request, 'blog/blogpost.html',
16+
{'post':post})

OTHERS/MyFavouriteCart/mfc/manage.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
"""Run administrative tasks."""
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mfc.settings')
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == '__main__':
22+
main()

OTHERS/MyFavouriteCart/mfc/mfc/__init__.py

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for mfc project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mfc.settings')
15+
16+
application = get_asgi_application()

0 commit comments

Comments
 (0)