├── .gitignore ├── db.sqlite3 ├── diagram.jpg ├── initial_data.json ├── landing ├── __init__.py ├── admin.py ├── forms.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_auto_20170111_1350.py │ ├── 0003_auto_20170122_1651.py │ └── __init__.py ├── models.py ├── urls.py └── views.py ├── manage.py ├── orders ├── __init__.py ├── admin.py ├── context_processors.py ├── forms.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_auto_20170122_1726.py │ ├── 0003_auto_20170122_1727.py │ ├── 0004_auto_20170205_1206.py │ ├── 0005_productinbasket.py │ ├── 0006_productinbasket_session_key.py │ ├── 0007_order_user.py │ └── __init__.py ├── models.py ├── urls.py └── views.py ├── products ├── __init__.py ├── admin.py ├── forms.py ├── migrations │ ├── 0001_initial.py │ ├── 0002_auto_20170122_1710.py │ ├── 0003_product_price.py │ ├── 0004_product_short_description.py │ ├── 0005_productimage_is_main.py │ ├── 0006_auto_20170212_1900.py │ └── __init__.py ├── models.py ├── urls.py └── views.py ├── static ├── media │ └── products_images │ │ ├── MKTQ2_image_01.jpg │ │ ├── MKTQ2_image_02.jpg │ │ ├── MacBook_256_Silver_image_01.jpg │ │ ├── MacBook_256_Silver_image_02.jpg │ │ ├── MacBook_256_Silver_image_03.jpg │ │ ├── MacBook_256_Silver_image_04.jpg │ │ ├── Space_Gray_image_01.jpg │ │ ├── Space_Gray_image_02.jpg │ │ ├── Space_Gray_image_03.jpg │ │ ├── a1.jpg │ │ ├── iphone_7_black-image_02_eMhZq62.jpg │ │ ├── iphone_7_jet_black-image_01_U5CakOv.jpg │ │ ├── iphone_7_silver-image_01_3pHyPtA_1.jpg │ │ └── iphone_7_silver-image_02_63s6q7L.jpg ├── static_dev │ ├── css │ │ ├── landing.css │ │ └── style.css │ ├── img │ │ ├── bg_image.jpg │ │ └── slider0.jpg │ └── js │ │ └── scripts.js └── static_prod │ ├── admin │ ├── css │ │ ├── base.css │ │ ├── changelists.css │ │ ├── dashboard.css │ │ ├── fonts.css │ │ ├── forms.css │ │ ├── login.css │ │ ├── rtl.css │ │ └── widgets.css │ ├── fonts │ │ ├── LICENSE.txt │ │ ├── README.txt │ │ ├── Roboto-Bold-webfont.woff │ │ ├── Roboto-Light-webfont.woff │ │ └── Roboto-Regular-webfont.woff │ ├── img │ │ ├── LICENSE │ │ ├── README.txt │ │ ├── calendar-icons.svg │ │ ├── gis │ │ │ ├── move_vertex_off.svg │ │ │ └── move_vertex_on.svg │ │ ├── icon-addlink.svg │ │ ├── icon-alert.svg │ │ ├── icon-calendar.svg │ │ ├── icon-changelink.svg │ │ ├── icon-clock.svg │ │ ├── icon-deletelink.svg │ │ ├── icon-no.svg │ │ ├── icon-unknown-alt.svg │ │ ├── icon-unknown.svg │ │ ├── icon-yes.svg │ │ ├── inline-delete.svg │ │ ├── search.svg │ │ ├── selector-icons.svg │ │ ├── sorting-icons.svg │ │ ├── tooltag-add.svg │ │ └── tooltag-arrowright.svg │ └── js │ │ ├── SelectBox.js │ │ ├── SelectFilter2.js │ │ ├── actions.js │ │ ├── actions.min.js │ │ ├── admin │ │ ├── DateTimeShortcuts.js │ │ └── RelatedObjectLookups.js │ │ ├── calendar.js │ │ ├── cancel.js │ │ ├── change_form.js │ │ ├── collapse.js │ │ ├── collapse.min.js │ │ ├── core.js │ │ ├── inlines.js │ │ ├── inlines.min.js │ │ ├── jquery.init.js │ │ ├── popup_response.js │ │ ├── prepopulate.js │ │ ├── prepopulate.min.js │ │ ├── prepopulate_init.js │ │ ├── timeparse.js │ │ ├── urlify.js │ │ └── vendor │ │ ├── jquery │ │ ├── LICENSE-JQUERY.txt │ │ ├── jquery.js │ │ └── jquery.min.js │ │ └── xregexp │ │ ├── LICENSE-XREGEXP.txt │ │ ├── xregexp.js │ │ └── xregexp.min.js │ ├── css │ ├── landing.css │ └── style.css │ ├── img │ ├── bg_image.jpg │ └── slider0.jpg │ └── js │ └── scripts.js ├── templates ├── base.html ├── footer.html ├── landing │ ├── home.html │ ├── landing.html │ ├── product_item.html │ └── test.html ├── navbar.html ├── orders │ └── checkout.html └── products │ └── product.html ├── test_project ├── __init__.py ├── settings.py ├── settings_prod1.py ├── urls.py └── wsgi.py └── utils └── main.py /.gitignore: -------------------------------------------------------------------------------- 1 | # If you need to exclude files such as those generated by an IDE, use 2 | # $GIT_DIR/info/exclude or the core.excludesFile configuration variable as 3 | # described in https://git-scm.com/docs/gitignore 4 | 5 | .idea/ 6 | 7 | *.egg-info 8 | *.pot 9 | *.py[co] 10 | .tox/ 11 | __pycache__ 12 | MANIFEST 13 | dist/ 14 | docs/_build/ 15 | docs/locale/ 16 | node_modules/ 17 | tests/coverage_html/ 18 | tests/.coverage 19 | build/ 20 | tests/report/ 21 | 22 | 23 | # Byte-compiled / optimized / DLL files 24 | __pycache__/ 25 | *.py[cod] 26 | *$py.class 27 | 28 | # C extensions 29 | *.so 30 | 31 | # Distribution / packaging 32 | .Python 33 | env/ 34 | build/ 35 | develop-eggs/ 36 | dist/ 37 | downloads/ 38 | eggs/ 39 | .eggs/ 40 | lib/ 41 | lib64/ 42 | parts/ 43 | sdist/ 44 | var/ 45 | wheels/ 46 | *.egg-info/ 47 | .installed.cfg 48 | *.egg 49 | 50 | # PyInstaller 51 | # Usually these files are written by a python script from a template 52 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 53 | *.manifest 54 | *.spec 55 | 56 | # Installer logs 57 | pip-log.txt 58 | pip-delete-this-directory.txt 59 | 60 | # Unit test / coverage reports 61 | htmlcov/ 62 | .tox/ 63 | .coverage 64 | .coverage.* 65 | .cache 66 | nosetests.xml 67 | coverage.xml 68 | *,cover 69 | .hypothesis/ 70 | 71 | # Translations 72 | *.mo 73 | *.pot 74 | 75 | # Django stuff: 76 | *.log 77 | local_settings.py 78 | 79 | # Flask stuff: 80 | instance/ 81 | .webassets-cache 82 | 83 | # Scrapy stuff: 84 | .scrapy 85 | 86 | # Sphinx documentation 87 | docs/_build/ 88 | 89 | # PyBuilder 90 | target/ 91 | 92 | # Jupyter Notebook 93 | .ipynb_checkpoints 94 | 95 | # pyenv 96 | .python-version 97 | 98 | # celery beat schedule file 99 | celerybeat-schedule 100 | 101 | # dotenv 102 | .env 103 | 104 | # virtualenv 105 | .venv 106 | venv/ 107 | ENV/ 108 | 109 | # Spyder project settings 110 | .spyderproject 111 | 112 | # Rope project settings 113 | .ropeproject -------------------------------------------------------------------------------- /db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/db.sqlite3 -------------------------------------------------------------------------------- /diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/diagram.jpg -------------------------------------------------------------------------------- /landing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/landing/__init__.py -------------------------------------------------------------------------------- /landing/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import * 3 | 4 | 5 | class SubscriberAdmin (admin.ModelAdmin): 6 | # list_display = ["name", "email"] 7 | list_display = [field.name for field in Subscriber._meta.fields] 8 | list_filter = ['name',] 9 | search_fields = ['name', 'email'] 10 | 11 | fields = ["email"] 12 | 13 | # exclude = ["email"] 14 | # inlines = [FieldMappingInline] 15 | # fields = [] 16 | # #exclude = ["type"] 17 | # #list_filter = ('report_data',) 18 | # search_fields = ['category', 'subCategory', 'suggestKeyword'] 19 | 20 | class Meta: 21 | model = Subscriber 22 | 23 | admin.site.register(Subscriber, SubscriberAdmin) -------------------------------------------------------------------------------- /landing/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import * 3 | 4 | 5 | class SubscriberForm(forms.ModelForm): 6 | 7 | class Meta: 8 | model = Subscriber 9 | exclude = [""] 10 | 11 | -------------------------------------------------------------------------------- /landing/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-01-02 23:02 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='Subscribers', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('email', models.EmailField(max_length=254)), 21 | ('name', models.CharField(max_length=128)), 22 | ], 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /landing/migrations/0002_auto_20170111_1350.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-01-11 11:50 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('landing', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameModel( 16 | old_name='Subscribers', 17 | new_name='Subscriber', 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /landing/migrations/0003_auto_20170122_1651.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-01-22 14:51 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('landing', '0002_auto_20170111_1350'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterModelOptions( 16 | name='subscriber', 17 | options={'verbose_name': 'MySubscriber', 'verbose_name_plural': 'A lot of Subscribers'}, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /landing/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/landing/migrations/__init__.py -------------------------------------------------------------------------------- /landing/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Subscriber(models.Model): 5 | email = models.EmailField() 6 | name = models.CharField(max_length=128) 7 | 8 | def __str__(self): 9 | return "Пользователь %s %s" % (self.name, self.email,) 10 | 11 | class Meta: 12 | verbose_name = 'MySubscriber' 13 | verbose_name_plural = 'A lot of Subscribers' -------------------------------------------------------------------------------- /landing/urls.py: -------------------------------------------------------------------------------- 1 | """test_project URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.10/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url, include 17 | from django.contrib import admin 18 | from landing import views 19 | 20 | urlpatterns = [ 21 | url(r'^$', views.home, name='home'), 22 | url(r'^landing123/$', views.landing, name='landing'), 23 | ] 24 | -------------------------------------------------------------------------------- /landing/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from .forms import SubscriberForm 3 | from products.models import * 4 | 5 | 6 | def landing(request): 7 | name = "CodingMedved" 8 | current_day = "03.01.2017" 9 | form = SubscriberForm(request.POST or None) 10 | 11 | if request.method == "POST" and form.is_valid(): 12 | print (request.POST) 13 | print (form.cleaned_data) 14 | data = form.cleaned_data 15 | print (data["name"]) 16 | 17 | new_form = form.save() 18 | 19 | return render(request, 'landing/landing.html', locals()) 20 | 21 | 22 | def home(request): 23 | products_images = ProductImage.objects.filter(is_active=True, is_main=True, product__is_active=True) 24 | products_images_phones = products_images.filter(product__category__id=1) 25 | products_images_laptops = products_images.filter(product__category__id=2) 26 | return render(request, 'landing/home.html', locals()) 27 | -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError: 10 | # The above import may fail for some other reason. Ensure that the 11 | # issue is really that Django is missing to avoid masking other 12 | # exceptions on Python 2. 13 | try: 14 | import django 15 | except ImportError: 16 | raise ImportError( 17 | "Couldn't import Django. Are you sure it's installed and " 18 | "available on your PYTHONPATH environment variable? Did you " 19 | "forget to activate a virtual environment?" 20 | ) 21 | raise 22 | execute_from_command_line(sys.argv) 23 | -------------------------------------------------------------------------------- /orders/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/orders/__init__.py -------------------------------------------------------------------------------- /orders/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import * 3 | 4 | 5 | class ProductInOrderInline(admin.TabularInline): 6 | model = ProductInOrder 7 | extra = 0 8 | 9 | 10 | class StatusAdmin (admin.ModelAdmin): 11 | list_display = [field.name for field in Status._meta.fields] 12 | 13 | class Meta: 14 | model = Status 15 | 16 | admin.site.register(Status, StatusAdmin) 17 | 18 | 19 | class OrderAdmin (admin.ModelAdmin): 20 | list_display = [field.name for field in Order._meta.fields] 21 | inlines = [ProductInOrderInline] 22 | 23 | class Meta: 24 | model = Order 25 | 26 | admin.site.register(Order, OrderAdmin) 27 | 28 | 29 | class ProductInOrderAdmin (admin.ModelAdmin): 30 | list_display = [field.name for field in ProductInOrder._meta.fields] 31 | 32 | class Meta: 33 | model = ProductInOrder 34 | 35 | admin.site.register(ProductInOrder, ProductInOrderAdmin) 36 | 37 | 38 | class ProductInBasketAdmin (admin.ModelAdmin): 39 | list_display = [field.name for field in ProductInBasket._meta.fields] 40 | 41 | class Meta: 42 | model = ProductInBasket 43 | 44 | admin.site.register(ProductInBasket, ProductInBasketAdmin) 45 | -------------------------------------------------------------------------------- /orders/context_processors.py: -------------------------------------------------------------------------------- 1 | from .models import ProductInBasket 2 | 3 | 4 | def getting_basket_info(request): 5 | 6 | session_key = request.session.session_key 7 | if not session_key: 8 | #workaround for newer Django versions 9 | request.session["session_key"] = 123 10 | #re-apply value 11 | request.session.cycle_key() 12 | 13 | products_in_basket = ProductInBasket.objects.filter(session_key=session_key, is_active=True, order__isnull=True) 14 | products_total_nmb = products_in_basket.count() 15 | 16 | return locals() -------------------------------------------------------------------------------- /orders/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import * 3 | 4 | 5 | class CheckoutContactForm(forms.Form): 6 | name = forms.CharField(required=True) 7 | phone = forms.CharField(required=True) -------------------------------------------------------------------------------- /orders/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-01-22 14:52 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ('products', '0001_initial'), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='Order', 20 | fields=[ 21 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('customer_name', models.CharField(blank=True, default=None, max_length=64, null=True)), 23 | ('customer_email', models.EmailField(blank=True, default=None, max_length=254, null=True)), 24 | ('customer_phone', models.CharField(blank=True, default=None, max_length=48, null=True)), 25 | ('comments', models.TextField(blank=True, default=None, null=True)), 26 | ('created', models.DateTimeField(auto_now_add=True)), 27 | ('updated', models.DateTimeField(auto_now=True)), 28 | ], 29 | options={ 30 | 'verbose_name_plural': 'Заказы', 31 | 'verbose_name': 'Заказ', 32 | }, 33 | ), 34 | migrations.CreateModel( 35 | name='ProductInOrder', 36 | fields=[ 37 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 38 | ('is_active', models.BooleanField(default=True)), 39 | ('created', models.DateTimeField(auto_now_add=True)), 40 | ('updated', models.DateTimeField(auto_now=True)), 41 | ('order', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='orders.Order')), 42 | ('product', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='products.Product')), 43 | ], 44 | options={ 45 | 'verbose_name_plural': 'Товары', 46 | 'verbose_name': 'Товар', 47 | }, 48 | ), 49 | migrations.CreateModel( 50 | name='Status', 51 | fields=[ 52 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 53 | ('name', models.CharField(blank=True, default=None, max_length=24, null=True)), 54 | ('is_active', models.BooleanField(default=True)), 55 | ('created', models.DateTimeField(auto_now_add=True)), 56 | ('updated', models.DateTimeField(auto_now=True)), 57 | ], 58 | options={ 59 | 'verbose_name_plural': 'Статусы заказа', 60 | 'verbose_name': 'Статус заказа', 61 | }, 62 | ), 63 | migrations.AddField( 64 | model_name='order', 65 | name='status', 66 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='orders.Status'), 67 | ), 68 | ] 69 | -------------------------------------------------------------------------------- /orders/migrations/0002_auto_20170122_1726.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-01-22 15:26 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('orders', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='order', 17 | name='customer_address', 18 | field=models.CharField(blank=True, default=None, max_length=128, null=True), 19 | ), 20 | migrations.AddField( 21 | model_name='order', 22 | name='total_amount', 23 | field=models.DecimalField(decimal_places=2, default=0, max_digits=10), 24 | ), 25 | migrations.AddField( 26 | model_name='productinorder', 27 | name='nmb', 28 | field=models.IntegerField(default=1), 29 | ), 30 | migrations.AddField( 31 | model_name='productinorder', 32 | name='price_per_item', 33 | field=models.DecimalField(decimal_places=2, default=0, max_digits=10), 34 | ), 35 | migrations.AddField( 36 | model_name='productinorder', 37 | name='total_price', 38 | field=models.DecimalField(decimal_places=2, default=0, max_digits=10), 39 | ), 40 | ] 41 | -------------------------------------------------------------------------------- /orders/migrations/0003_auto_20170122_1727.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-01-22 15:27 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('orders', '0002_auto_20170122_1726'), 12 | ] 13 | 14 | operations = [ 15 | migrations.RenameField( 16 | model_name='order', 17 | old_name='total_amount', 18 | new_name='total_price', 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /orders/migrations/0004_auto_20170205_1206.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-02-05 10:06 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('orders', '0003_auto_20170122_1727'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterModelOptions( 16 | name='productinorder', 17 | options={'verbose_name': 'Товар в заказе', 'verbose_name_plural': 'Товары в заказе'}, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /orders/migrations/0005_productinbasket.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-04-02 16:12 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('products', '0006_auto_20170212_1900'), 13 | ('orders', '0004_auto_20170205_1206'), 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='ProductInBasket', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('nmb', models.IntegerField(default=1)), 22 | ('price_per_item', models.DecimalField(decimal_places=2, default=0, max_digits=10)), 23 | ('total_price', models.DecimalField(decimal_places=2, default=0, max_digits=10)), 24 | ('is_active', models.BooleanField(default=True)), 25 | ('created', models.DateTimeField(auto_now_add=True)), 26 | ('updated', models.DateTimeField(auto_now=True)), 27 | ('order', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='orders.Order')), 28 | ('product', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='products.Product')), 29 | ], 30 | options={ 31 | 'verbose_name': 'Товар в корзине', 32 | 'verbose_name_plural': 'Товары в корзине', 33 | }, 34 | ), 35 | ] 36 | -------------------------------------------------------------------------------- /orders/migrations/0006_productinbasket_session_key.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-04-02 16:14 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('orders', '0005_productinbasket'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='productinbasket', 17 | name='session_key', 18 | field=models.CharField(blank=True, default=None, max_length=128, null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /orders/migrations/0007_order_user.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-05-16 21:12 3 | from __future__ import unicode_literals 4 | 5 | from django.conf import settings 6 | from django.db import migrations, models 7 | import django.db.models.deletion 8 | 9 | 10 | class Migration(migrations.Migration): 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ('orders', '0006_productinbasket_session_key'), 15 | ] 16 | 17 | operations = [ 18 | migrations.AddField( 19 | model_name='order', 20 | name='user', 21 | field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /orders/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/orders/migrations/__init__.py -------------------------------------------------------------------------------- /orders/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from products.models import Product 3 | from django.db.models.signals import post_save 4 | from django.contrib.auth.models import User 5 | from utils.main import disable_for_loaddata 6 | 7 | 8 | class Status(models.Model): 9 | name = models.CharField(max_length=24, blank=True, null=True, default=None) 10 | is_active = models.BooleanField(default=True) 11 | created = models.DateTimeField(auto_now_add=True, auto_now=False) 12 | updated = models.DateTimeField(auto_now_add=False, auto_now=True) 13 | 14 | def __str__(self): 15 | return "Статус %s" % self.name 16 | 17 | class Meta: 18 | verbose_name = 'Статус заказа' 19 | verbose_name_plural = 'Статусы заказа' 20 | 21 | 22 | class Order(models.Model): 23 | user = models.ForeignKey(User, blank=True, null=True, default=None) 24 | total_price = models.DecimalField(max_digits=10, decimal_places=2, default=0)#total price for all products in order 25 | customer_name = models.CharField(max_length=64, blank=True, null=True, default=None) 26 | customer_email = models.EmailField(blank=True, null=True, default=None) 27 | customer_phone = models.CharField(max_length=48, blank=True, null=True, default=None) 28 | customer_address = models.CharField(max_length=128, blank=True, null=True, default=None) 29 | comments = models.TextField(blank=True, null=True, default=None) 30 | status = models.ForeignKey(Status) 31 | created = models.DateTimeField(auto_now_add=True, auto_now=False) 32 | updated = models.DateTimeField(auto_now_add=False, auto_now=True) 33 | 34 | def __str__(self): 35 | return "Заказ %s %s" % (self.id, self.status.name) 36 | 37 | class Meta: 38 | verbose_name = 'Заказ' 39 | verbose_name_plural = 'Заказы' 40 | 41 | def save(self, *args, **kwargs): 42 | 43 | super(Order, self).save(*args, **kwargs) 44 | 45 | 46 | class ProductInOrder(models.Model): 47 | order = models.ForeignKey(Order, blank=True, null=True, default=None) 48 | product = models.ForeignKey(Product, blank=True, null=True, default=None) 49 | nmb = models.IntegerField(default=1) 50 | price_per_item = models.DecimalField(max_digits=10, decimal_places=2, default=0) 51 | total_price = models.DecimalField(max_digits=10, decimal_places=2, default=0)#price*nmb 52 | is_active = models.BooleanField(default=True) 53 | created = models.DateTimeField(auto_now_add=True, auto_now=False) 54 | updated = models.DateTimeField(auto_now_add=False, auto_now=True) 55 | 56 | def __str__(self): 57 | return "%s" % self.product.name 58 | 59 | class Meta: 60 | verbose_name = 'Товар в заказе' 61 | verbose_name_plural = 'Товары в заказе' 62 | 63 | 64 | def save(self, *args, **kwargs): 65 | price_per_item = self.product.price 66 | self.price_per_item = price_per_item 67 | print (self.nmb) 68 | 69 | self.total_price = int(self.nmb) * price_per_item 70 | 71 | super(ProductInOrder, self).save(*args, **kwargs) 72 | 73 | 74 | @disable_for_loaddata 75 | def product_in_order_post_save(sender, instance, created, **kwargs): 76 | order = instance.order 77 | all_products_in_order = ProductInOrder.objects.filter(order=order, is_active=True) 78 | 79 | order_total_price = 0 80 | for item in all_products_in_order: 81 | order_total_price += item.total_price 82 | 83 | instance.order.total_price = order_total_price 84 | instance.order.save(force_update=True) 85 | 86 | 87 | post_save.connect(product_in_order_post_save, sender=ProductInOrder) 88 | 89 | 90 | class ProductInBasket(models.Model): 91 | session_key = models.CharField(max_length=128, blank=True, null=True, default=None) 92 | order = models.ForeignKey(Order, blank=True, null=True, default=None) 93 | product = models.ForeignKey(Product, blank=True, null=True, default=None) 94 | nmb = models.IntegerField(default=1) 95 | price_per_item = models.DecimalField(max_digits=10, decimal_places=2, default=0) 96 | total_price = models.DecimalField(max_digits=10, decimal_places=2, default=0)#price*nmb 97 | is_active = models.BooleanField(default=True) 98 | created = models.DateTimeField(auto_now_add=True, auto_now=False) 99 | updated = models.DateTimeField(auto_now_add=False, auto_now=True) 100 | 101 | def __str__(self): 102 | return "%s" % self.product.name 103 | 104 | class Meta: 105 | verbose_name = 'Товар в корзине' 106 | verbose_name_plural = 'Товары в корзине' 107 | 108 | 109 | def save(self, *args, **kwargs): 110 | price_per_item = self.product.price 111 | self.price_per_item = price_per_item 112 | self.total_price = int(self.nmb) * price_per_item 113 | 114 | super(ProductInBasket, self).save(*args, **kwargs) -------------------------------------------------------------------------------- /orders/urls.py: -------------------------------------------------------------------------------- 1 | """test_project URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.10/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url, include 17 | from django.contrib import admin 18 | from . import views 19 | 20 | urlpatterns = [ 21 | 22 | url(r'^basket_adding/$', views.basket_adding, name='basket_adding'), 23 | url(r'^checkout/$', views.checkout, name='checkout'), 24 | 25 | ] 26 | -------------------------------------------------------------------------------- /orders/views.py: -------------------------------------------------------------------------------- 1 | from django.http import JsonResponse, HttpResponse, HttpResponseRedirect 2 | from .models import * 3 | from django.shortcuts import render 4 | from .forms import CheckoutContactForm 5 | from django.contrib.auth.models import User 6 | 7 | 8 | def basket_adding(request): 9 | return_dict = dict() 10 | session_key = request.session.session_key 11 | print (request.POST) 12 | data = request.POST 13 | product_id = data.get("product_id") 14 | nmb = data.get("nmb") 15 | is_delete = data.get("is_delete") 16 | 17 | if is_delete == 'true': 18 | ProductInBasket.objects.filter(id=product_id).update(is_active=False) 19 | else: 20 | new_product, created = ProductInBasket.objects.get_or_create(session_key=session_key, product_id=product_id, 21 | is_active=True, defaults={"nmb": nmb}) 22 | if not created: 23 | print ("not created") 24 | new_product.nmb += int(nmb) 25 | new_product.save(force_update=True) 26 | 27 | #common code for 2 cases 28 | products_in_basket = ProductInBasket.objects.filter(session_key=session_key, is_active=True, order__isnull=True) 29 | products_total_nmb = products_in_basket.count() 30 | return_dict["products_total_nmb"] = products_total_nmb 31 | 32 | return_dict["products"] = list() 33 | 34 | for item in products_in_basket: 35 | product_dict = dict() 36 | product_dict["id"] = item.id 37 | product_dict["name"] = item.product.name 38 | product_dict["price_per_item"] = item.price_per_item 39 | product_dict["nmb"] = item.nmb 40 | return_dict["products"].append(product_dict) 41 | 42 | return JsonResponse(return_dict) 43 | 44 | 45 | def checkout(request): 46 | session_key = request.session.session_key 47 | products_in_basket = ProductInBasket.objects.filter(session_key=session_key, is_active=True, order__isnull=True) 48 | print (products_in_basket) 49 | for item in products_in_basket: 50 | print(item.order) 51 | 52 | 53 | form = CheckoutContactForm(request.POST or None) 54 | if request.POST: 55 | print(request.POST) 56 | if form.is_valid(): 57 | print("yes") 58 | data = request.POST 59 | name = data.get("name", "3423453") 60 | phone = data["phone"] 61 | user, created = User.objects.get_or_create(username=phone, defaults={"first_name": name}) 62 | 63 | order = Order.objects.create(user=user, customer_name=name, customer_phone=phone, status_id=1) 64 | 65 | for name, value in data.items(): 66 | if name.startswith("product_in_basket_"): 67 | product_in_basket_id = name.split("product_in_basket_")[1] 68 | product_in_basket = ProductInBasket.objects.get(id=product_in_basket_id) 69 | print(type(value)) 70 | 71 | product_in_basket.nmb = value 72 | product_in_basket.order = order 73 | product_in_basket.save(force_update=True) 74 | 75 | ProductInOrder.objects.create(product=product_in_basket.product, nmb = product_in_basket.nmb, 76 | price_per_item=product_in_basket.price_per_item, 77 | total_price = product_in_basket.total_price, 78 | order=order) 79 | 80 | return HttpResponseRedirect(request.META['HTTP_REFERER']) 81 | else: 82 | print("no") 83 | return render(request, 'orders/checkout.html', locals()) -------------------------------------------------------------------------------- /products/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/products/__init__.py -------------------------------------------------------------------------------- /products/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import * 3 | 4 | 5 | class ProductImageInline(admin.TabularInline): 6 | model = ProductImage 7 | extra = 0 8 | 9 | 10 | class ProductCategoryAdmin(admin.ModelAdmin): 11 | list_display = [field.name for field in ProductCategory._meta.fields] 12 | 13 | class Meta: 14 | model = ProductCategory 15 | 16 | admin.site.register(ProductCategory, ProductCategoryAdmin) 17 | 18 | 19 | class ProductAdmin (admin.ModelAdmin): 20 | list_display = [field.name for field in Product._meta.fields] 21 | inlines = [ProductImageInline] 22 | 23 | class Meta: 24 | model = Product 25 | 26 | admin.site.register(Product, ProductAdmin) 27 | 28 | 29 | class ProductImageAdmin (admin.ModelAdmin): 30 | list_display = [field.name for field in ProductImage._meta.fields] 31 | 32 | class Meta: 33 | model = ProductImage 34 | 35 | admin.site.register(ProductImage, ProductImageAdmin) -------------------------------------------------------------------------------- /products/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import * 3 | 4 | 5 | # class SubscriberForm(forms.ModelForm): 6 | # 7 | # class Meta: 8 | # model = Subscriber 9 | # exclude = [""] 10 | 11 | -------------------------------------------------------------------------------- /products/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-01-22 14:52 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='Product', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('name', models.CharField(blank=True, default=None, max_length=64, null=True)), 22 | ('description', models.TextField(blank=True, default=None, null=True)), 23 | ('is_active', models.BooleanField(default=True)), 24 | ('created', models.DateTimeField(auto_now_add=True)), 25 | ('updated', models.DateTimeField(auto_now=True)), 26 | ], 27 | options={ 28 | 'verbose_name_plural': 'Товары', 29 | 'verbose_name': 'Товар', 30 | }, 31 | ), 32 | migrations.CreateModel( 33 | name='ProductImage', 34 | fields=[ 35 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 36 | ('image', models.ImageField(upload_to='/products_images/')), 37 | ('is_active', models.BooleanField(default=True)), 38 | ('created', models.DateTimeField(auto_now_add=True)), 39 | ('updated', models.DateTimeField(auto_now=True)), 40 | ('product', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='products.Product')), 41 | ], 42 | options={ 43 | 'verbose_name_plural': 'Фотографии', 44 | 'verbose_name': 'Фотография', 45 | }, 46 | ), 47 | ] 48 | -------------------------------------------------------------------------------- /products/migrations/0002_auto_20170122_1710.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-01-22 15:10 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('products', '0001_initial'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AlterField( 16 | model_name='productimage', 17 | name='image', 18 | field=models.ImageField(upload_to='products_images/'), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /products/migrations/0003_product_price.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-02-05 10:06 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('products', '0002_auto_20170122_1710'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='product', 17 | name='price', 18 | field=models.DecimalField(decimal_places=2, default=0, max_digits=10), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /products/migrations/0004_product_short_description.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-02-12 12:59 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('products', '0003_product_price'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='product', 17 | name='short_description', 18 | field=models.TextField(blank=True, default=None, null=True), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /products/migrations/0005_productimage_is_main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-02-12 13:09 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | dependencies = [ 11 | ('products', '0004_product_short_description'), 12 | ] 13 | 14 | operations = [ 15 | migrations.AddField( 16 | model_name='productimage', 17 | name='is_main', 18 | field=models.BooleanField(default=False), 19 | ), 20 | ] 21 | -------------------------------------------------------------------------------- /products/migrations/0006_auto_20170212_1900.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Generated by Django 1.10.4 on 2017-02-12 17:00 3 | from __future__ import unicode_literals 4 | 5 | from django.db import migrations, models 6 | import django.db.models.deletion 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | dependencies = [ 12 | ('products', '0005_productimage_is_main'), 13 | ] 14 | 15 | operations = [ 16 | migrations.CreateModel( 17 | name='ProductCategory', 18 | fields=[ 19 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 20 | ('name', models.CharField(blank=True, default=None, max_length=64, null=True)), 21 | ('is_active', models.BooleanField(default=True)), 22 | ], 23 | options={ 24 | 'verbose_name': 'Категория товара', 25 | 'verbose_name_plural': 'Категория товаров', 26 | }, 27 | ), 28 | migrations.AddField( 29 | model_name='product', 30 | name='discount', 31 | field=models.IntegerField(default=0), 32 | ), 33 | migrations.AddField( 34 | model_name='product', 35 | name='category', 36 | field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='products.ProductCategory'), 37 | ), 38 | ] 39 | -------------------------------------------------------------------------------- /products/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/products/migrations/__init__.py -------------------------------------------------------------------------------- /products/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class ProductCategory(models.Model): 5 | name = models.CharField(max_length=64, blank=True, null=True, default=None) 6 | is_active = models.BooleanField(default=True) 7 | 8 | def __str__(self): 9 | return "%s" % self.name 10 | 11 | class Meta: 12 | verbose_name = 'Категория товара' 13 | verbose_name_plural = 'Категория товаров' 14 | 15 | 16 | class Product(models.Model): 17 | name = models.CharField(max_length=64, blank=True, null=True, default=None) 18 | price = models.DecimalField(max_digits=10, decimal_places=2, default=0) 19 | discount = models.IntegerField(default=0) 20 | category = models.ForeignKey(ProductCategory, blank=True, null=True, default=None) 21 | short_description = models.TextField(blank=True, null=True, default=None) 22 | description = models.TextField(blank=True, null=True, default=None) 23 | is_active = models.BooleanField(default=True) 24 | created = models.DateTimeField(auto_now_add=True, auto_now=False) 25 | updated = models.DateTimeField(auto_now_add=False, auto_now=True) 26 | 27 | def __str__(self): 28 | return "%s, %s" % (self.price, self.name) 29 | 30 | class Meta: 31 | verbose_name = 'Товар' 32 | verbose_name_plural = 'Товары' 33 | 34 | 35 | class ProductImage(models.Model): 36 | product = models.ForeignKey(Product, blank=True, null=True, default=None) 37 | image = models.ImageField(upload_to='products_images/') 38 | is_main = models.BooleanField(default=False) 39 | is_active = models.BooleanField(default=True) 40 | created = models.DateTimeField(auto_now_add=True, auto_now=False) 41 | updated = models.DateTimeField(auto_now_add=False, auto_now=True) 42 | 43 | def __str__(self): 44 | return "%s" % self.id 45 | 46 | class Meta: 47 | verbose_name = 'Фотография' 48 | verbose_name_plural = 'Фотографии' -------------------------------------------------------------------------------- /products/urls.py: -------------------------------------------------------------------------------- 1 | """test_project URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.10/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url, include 17 | from django.contrib import admin 18 | from products import views 19 | 20 | urlpatterns = [ 21 | # url(r'^landing123/', views.landing, name='landing'), 22 | url(r'^product/(?P\w+)/$', views.product, name='product'), 23 | ] 24 | -------------------------------------------------------------------------------- /products/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from products.models import * 3 | 4 | 5 | def product(request, product_id): 6 | product = Product.objects.get(id=product_id) 7 | 8 | 9 | session_key = request.session.session_key 10 | if not session_key: 11 | request.session.cycle_key() 12 | 13 | print(request.session.session_key) 14 | 15 | 16 | return render(request, 'products/product.html', locals()) -------------------------------------------------------------------------------- /static/media/products_images/MKTQ2_image_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/MKTQ2_image_01.jpg -------------------------------------------------------------------------------- /static/media/products_images/MKTQ2_image_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/MKTQ2_image_02.jpg -------------------------------------------------------------------------------- /static/media/products_images/MacBook_256_Silver_image_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/MacBook_256_Silver_image_01.jpg -------------------------------------------------------------------------------- /static/media/products_images/MacBook_256_Silver_image_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/MacBook_256_Silver_image_02.jpg -------------------------------------------------------------------------------- /static/media/products_images/MacBook_256_Silver_image_03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/MacBook_256_Silver_image_03.jpg -------------------------------------------------------------------------------- /static/media/products_images/MacBook_256_Silver_image_04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/MacBook_256_Silver_image_04.jpg -------------------------------------------------------------------------------- /static/media/products_images/Space_Gray_image_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/Space_Gray_image_01.jpg -------------------------------------------------------------------------------- /static/media/products_images/Space_Gray_image_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/Space_Gray_image_02.jpg -------------------------------------------------------------------------------- /static/media/products_images/Space_Gray_image_03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/Space_Gray_image_03.jpg -------------------------------------------------------------------------------- /static/media/products_images/a1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/a1.jpg -------------------------------------------------------------------------------- /static/media/products_images/iphone_7_black-image_02_eMhZq62.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/iphone_7_black-image_02_eMhZq62.jpg -------------------------------------------------------------------------------- /static/media/products_images/iphone_7_jet_black-image_01_U5CakOv.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/iphone_7_jet_black-image_01_U5CakOv.jpg -------------------------------------------------------------------------------- /static/media/products_images/iphone_7_silver-image_01_3pHyPtA_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/iphone_7_silver-image_01_3pHyPtA_1.jpg -------------------------------------------------------------------------------- /static/media/products_images/iphone_7_silver-image_02_63s6q7L.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/media/products_images/iphone_7_silver-image_02_63s6q7L.jpg -------------------------------------------------------------------------------- /static/static_dev/css/landing.css: -------------------------------------------------------------------------------- 1 | html, body{ 2 | height: 100%; 3 | max-height: 100%; 4 | font-family: 'Roboto', sans-serif; 5 | } 6 | 7 | .top-container{ 8 | padding-top: 10%; 9 | } 10 | 11 | .general-container{ 12 | background: url('../img/bg_image.jpg'); 13 | height: 100%; 14 | } 15 | 16 | .general-container form{ 17 | margin-top: 30px; 18 | } 19 | 20 | .general-container form label{ 21 | font-weight: 100; 22 | color: white; 23 | } 24 | 25 | .btn-orange{ 26 | background-color: #e8643e; 27 | border: none; 28 | } 29 | 30 | .btn-orange:hover{ 31 | background-color: #dc5129; 32 | border: none; 33 | } 34 | 35 | .title{ 36 | text-align: center; 37 | color: white; 38 | font-weight: 100; 39 | line-height: 50px; 40 | } -------------------------------------------------------------------------------- /static/static_dev/css/style.css: -------------------------------------------------------------------------------- 1 | html, body{ 2 | height: 100%; 3 | max-height: 100%; 4 | font-family: 'Roboto', sans-serif; 5 | background-color: #edeef0; 6 | } 7 | 8 | .navbar{ 9 | margin-bottom: 0; 10 | } 11 | 12 | .wrapper{ 13 | min-height: 100%; 14 | } 15 | 16 | .wrapper-content{ 17 | overflow: auto; 18 | padding-bottom: 180px; /* must be same height as the footer */ 19 | } 20 | 21 | .footer{ 22 | position: relative; 23 | margin-top: -180px; /* negative value of footer height */ 24 | height: 180px; 25 | clear: both; 26 | background-color: white; 27 | } 28 | 29 | .section-top{ 30 | margin-bottom: 20px 31 | } 32 | 33 | .product-description-tabs{ 34 | padding: 10px; 35 | } 36 | 37 | .section{ 38 | padding: 50px 0; 39 | } 40 | 41 | .section h1{ 42 | margin-bottom: 40px; 43 | } 44 | 45 | .product-item{ 46 | height: 360px; 47 | background-color: white; 48 | border: 1px solid lightgrey; 49 | position: relative; 50 | padding: 10px 0 10px 0; 51 | text-align: center; 52 | margin-bottom: 10px; 53 | } 54 | 55 | .add-to-card-btn{ 56 | position: absolute; 57 | bottom: 15px; 58 | left: 50%; 59 | transform: translateX(-50%); 60 | } 61 | 62 | .discount-container{ 63 | position: absolute; 64 | top: 30%; 65 | background: #55e073; 66 | width: 30%; 67 | color: white; 68 | font-weight: 700; 69 | padding: 3px; 70 | } 71 | 72 | .section-delivery{ 73 | height: 300px; 74 | background-color: darkseagreen; 75 | text-align: center; 76 | color: white; 77 | } 78 | 79 | .product-image-item{ 80 | padding: 5px; 81 | margin-bottom: 5px; 82 | } 83 | 84 | .navbar-top{ 85 | min-height: 10px; 86 | height: 20px; 87 | background-color: green; 88 | border: none; 89 | border-radius: 0; 90 | } 91 | 92 | .navbar-main{ 93 | background-color: #55e073; 94 | border: none; 95 | border-radius: 0; 96 | } 97 | 98 | .basket-container{ 99 | position: relative; 100 | width: 400px; 101 | padding: 15px 10px; 102 | } 103 | 104 | .basket-items{ 105 | position: absolute; 106 | top: 50px; 107 | width: 100%; 108 | background-color: #55e093; 109 | z-index: 10; 110 | padding: 10px; 111 | } 112 | 113 | .form-error{ 114 | color: red; 115 | } -------------------------------------------------------------------------------- /static/static_dev/img/bg_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/static_dev/img/bg_image.jpg -------------------------------------------------------------------------------- /static/static_dev/img/slider0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/static_dev/img/slider0.jpg -------------------------------------------------------------------------------- /static/static_dev/js/scripts.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | var form = $('#form_buying_product'); 3 | console.log(form); 4 | 5 | 6 | function basketUpdating(product_id, nmb, is_delete){ 7 | var data = {}; 8 | data.product_id = product_id; 9 | data.nmb = nmb; 10 | var csrf_token = $('#form_buying_product [name="csrfmiddlewaretoken"]').val(); 11 | data["csrfmiddlewaretoken"] = csrf_token; 12 | 13 | if (is_delete){ 14 | data["is_delete"] = true; 15 | } 16 | 17 | var url = form.attr("action"); 18 | 19 | console.log(data) 20 | $.ajax({ 21 | url: url, 22 | type: 'POST', 23 | data: data, 24 | cache: true, 25 | success: function (data) { 26 | console.log("OK"); 27 | console.log(data.products_total_nmb); 28 | if (data.products_total_nmb || data.products_total_nmb == 0){ 29 | $('#basket_total_nmb').text("("+data.products_total_nmb+")"); 30 | console.log(data.products); 31 | $('.basket-items ul').html(""); 32 | $.each(data.products, function(k, v){ 33 | $('.basket-items ul').append('
  • '+ v.name+', ' + v.nmb + 'шт. ' + 'по ' + v.price_per_item + 'грн ' + 34 | 'x'+ 35 | '
  • '); 36 | }); 37 | } 38 | 39 | }, 40 | error: function(){ 41 | console.log("error") 42 | } 43 | }) 44 | 45 | } 46 | 47 | form.on('submit', function(e){ 48 | e.preventDefault(); 49 | console.log('123'); 50 | var nmb = $('#number').val(); 51 | console.log(nmb); 52 | var submit_btn = $('#submit_btn'); 53 | var product_id = submit_btn.data("product_id"); 54 | var name = submit_btn.data("name"); 55 | var price = submit_btn.data("price"); 56 | console.log(product_id ); 57 | console.log(name); 58 | 59 | basketUpdating(product_id, nmb, is_delete=false) 60 | 61 | }); 62 | 63 | function showingBasket(){ 64 | $('.basket-items').removeClass('hidden'); 65 | }; 66 | 67 | //$('.basket-container').on('click', function(e){ 68 | // e.preventDefault(); 69 | // showingBasket(); 70 | //}); 71 | 72 | $('.basket-container').mouseover(function(){ 73 | showingBasket(); 74 | }); 75 | 76 | //$('.basket-container').mouseout(function(){ 77 | // showingBasket(); 78 | //}); 79 | 80 | $(document).on('click', '.delete-item', function(e){ 81 | e.preventDefault(); 82 | product_id = $(this).data("product_id") 83 | nmb = 0; 84 | basketUpdating(product_id, nmb, is_delete=true) 85 | }); 86 | 87 | function calculatingBasketAmount(){ 88 | var total_order_amount = 0; 89 | $('.total-product-in-basket-amount').each(function() { 90 | total_order_amount = total_order_amount + parseFloat($(this).text()); 91 | }); 92 | console.log(total_order_amount); 93 | $('#total_order_amount').text(total_order_amount.toFixed(2)); 94 | }; 95 | 96 | $(document).on('change', ".product-in-basket-nmb", function(){ 97 | var current_nmb = $(this).val(); 98 | console.log(current_nmb); 99 | 100 | var current_tr = $(this).closest('tr'); 101 | var current_price = parseFloat(current_tr.find('.product-price').text()).toFixed(2); 102 | console.log(current_price); 103 | var total_amount = parseFloat(current_nmb*current_price).toFixed(2); 104 | console.log(total_amount); 105 | current_tr.find('.total-product-in-basket-amount').text(total_amount); 106 | 107 | calculatingBasketAmount(); 108 | }); 109 | 110 | 111 | calculatingBasketAmount(); 112 | 113 | }); -------------------------------------------------------------------------------- /static/static_prod/admin/css/changelists.css: -------------------------------------------------------------------------------- 1 | /* CHANGELISTS */ 2 | 3 | #changelist { 4 | position: relative; 5 | width: 100%; 6 | } 7 | 8 | #changelist table { 9 | width: 100%; 10 | } 11 | 12 | .change-list .hiddenfields { display:none; } 13 | 14 | .change-list .filtered table { 15 | border-right: none; 16 | } 17 | 18 | .change-list .filtered { 19 | min-height: 400px; 20 | } 21 | 22 | .change-list .filtered .results, .change-list .filtered .paginator, 23 | .filtered #toolbar, .filtered div.xfull { 24 | margin-right: 280px; 25 | width: auto; 26 | } 27 | 28 | .change-list .filtered table tbody th { 29 | padding-right: 1em; 30 | } 31 | 32 | #changelist-form .results { 33 | overflow-x: auto; 34 | } 35 | 36 | #changelist .toplinks { 37 | border-bottom: 1px solid #ddd; 38 | } 39 | 40 | #changelist .paginator { 41 | color: #666; 42 | border-bottom: 1px solid #eee; 43 | background: #fff; 44 | overflow: hidden; 45 | } 46 | 47 | /* CHANGELIST TABLES */ 48 | 49 | #changelist table thead th { 50 | padding: 0; 51 | white-space: nowrap; 52 | vertical-align: middle; 53 | } 54 | 55 | #changelist table thead th.action-checkbox-column { 56 | width: 1.5em; 57 | text-align: center; 58 | } 59 | 60 | #changelist table tbody td.action-checkbox { 61 | text-align: center; 62 | } 63 | 64 | #changelist table tfoot { 65 | color: #666; 66 | } 67 | 68 | /* TOOLBAR */ 69 | 70 | #changelist #toolbar { 71 | padding: 8px 10px; 72 | margin-bottom: 15px; 73 | border-top: 1px solid #eee; 74 | border-bottom: 1px solid #eee; 75 | background: #f8f8f8; 76 | color: #666; 77 | } 78 | 79 | #changelist #toolbar form input { 80 | border-radius: 4px; 81 | font-size: 14px; 82 | padding: 5px; 83 | color: #333; 84 | } 85 | 86 | #changelist #toolbar form #searchbar { 87 | height: 19px; 88 | border: 1px solid #ccc; 89 | padding: 2px 5px; 90 | margin: 0; 91 | vertical-align: top; 92 | font-size: 13px; 93 | } 94 | 95 | #changelist #toolbar form #searchbar:focus { 96 | border-color: #999; 97 | } 98 | 99 | #changelist #toolbar form input[type="submit"] { 100 | border: 1px solid #ccc; 101 | padding: 2px 10px; 102 | margin: 0; 103 | vertical-align: middle; 104 | background: #fff; 105 | box-shadow: 0 -15px 20px -10px rgba(0, 0, 0, 0.15) inset; 106 | cursor: pointer; 107 | color: #333; 108 | } 109 | 110 | #changelist #toolbar form input[type="submit"]:focus, 111 | #changelist #toolbar form input[type="submit"]:hover { 112 | border-color: #999; 113 | } 114 | 115 | #changelist #changelist-search img { 116 | vertical-align: middle; 117 | margin-right: 4px; 118 | } 119 | 120 | /* FILTER COLUMN */ 121 | 122 | #changelist-filter { 123 | position: absolute; 124 | top: 0; 125 | right: 0; 126 | z-index: 1000; 127 | width: 240px; 128 | background: #f8f8f8; 129 | border-left: none; 130 | margin: 0; 131 | } 132 | 133 | #changelist-filter h2 { 134 | font-size: 14px; 135 | text-transform: uppercase; 136 | letter-spacing: 0.5px; 137 | padding: 5px 15px; 138 | margin-bottom: 12px; 139 | border-bottom: none; 140 | } 141 | 142 | #changelist-filter h3 { 143 | font-weight: 400; 144 | font-size: 14px; 145 | padding: 0 15px; 146 | margin-bottom: 10px; 147 | } 148 | 149 | #changelist-filter ul { 150 | margin: 5px 0; 151 | padding: 0 15px 15px; 152 | border-bottom: 1px solid #eaeaea; 153 | } 154 | 155 | #changelist-filter ul:last-child { 156 | border-bottom: none; 157 | padding-bottom: none; 158 | } 159 | 160 | #changelist-filter li { 161 | list-style-type: none; 162 | margin-left: 0; 163 | padding-left: 0; 164 | } 165 | 166 | #changelist-filter a { 167 | display: block; 168 | color: #999; 169 | } 170 | 171 | #changelist-filter li.selected { 172 | border-left: 5px solid #eaeaea; 173 | padding-left: 10px; 174 | margin-left: -15px; 175 | } 176 | 177 | #changelist-filter li.selected a { 178 | color: #5b80b2; 179 | } 180 | 181 | #changelist-filter a:focus, #changelist-filter a:hover, 182 | #changelist-filter li.selected a:focus, 183 | #changelist-filter li.selected a:hover { 184 | color: #036; 185 | } 186 | 187 | /* DATE DRILLDOWN */ 188 | 189 | .change-list ul.toplinks { 190 | display: block; 191 | float: left; 192 | padding: 0; 193 | margin: 0; 194 | width: 100%; 195 | } 196 | 197 | .change-list ul.toplinks li { 198 | padding: 3px 6px; 199 | font-weight: bold; 200 | list-style-type: none; 201 | display: inline-block; 202 | } 203 | 204 | .change-list ul.toplinks .date-back a { 205 | color: #999; 206 | } 207 | 208 | .change-list ul.toplinks .date-back a:focus, 209 | .change-list ul.toplinks .date-back a:hover { 210 | color: #036; 211 | } 212 | 213 | /* PAGINATOR */ 214 | 215 | .paginator { 216 | font-size: 13px; 217 | padding-top: 10px; 218 | padding-bottom: 10px; 219 | line-height: 22px; 220 | margin: 0; 221 | border-top: 1px solid #ddd; 222 | } 223 | 224 | .paginator a:link, .paginator a:visited { 225 | padding: 2px 6px; 226 | background: #79aec8; 227 | text-decoration: none; 228 | color: #fff; 229 | } 230 | 231 | .paginator a.showall { 232 | padding: 0; 233 | border: none; 234 | background: none; 235 | color: #5b80b2; 236 | } 237 | 238 | .paginator a.showall:focus, .paginator a.showall:hover { 239 | background: none; 240 | color: #036; 241 | } 242 | 243 | .paginator .end { 244 | margin-right: 6px; 245 | } 246 | 247 | .paginator .this-page { 248 | padding: 2px 6px; 249 | font-weight: bold; 250 | font-size: 13px; 251 | vertical-align: top; 252 | } 253 | 254 | .paginator a:focus, .paginator a:hover { 255 | color: white; 256 | background: #036; 257 | } 258 | 259 | /* ACTIONS */ 260 | 261 | .filtered .actions { 262 | margin-right: 280px; 263 | border-right: none; 264 | } 265 | 266 | #changelist table input { 267 | margin: 0; 268 | vertical-align: baseline; 269 | } 270 | 271 | #changelist table tbody tr.selected { 272 | background-color: #FFFFCC; 273 | } 274 | 275 | #changelist .actions { 276 | padding: 10px; 277 | background: #fff; 278 | border-top: none; 279 | border-bottom: none; 280 | line-height: 24px; 281 | color: #999; 282 | } 283 | 284 | #changelist .actions.selected { 285 | background: #fffccf; 286 | border-top: 1px solid #fffee8; 287 | border-bottom: 1px solid #edecd6; 288 | } 289 | 290 | #changelist .actions span.all, 291 | #changelist .actions span.action-counter, 292 | #changelist .actions span.clear, 293 | #changelist .actions span.question { 294 | font-size: 13px; 295 | margin: 0 0.5em; 296 | display: none; 297 | } 298 | 299 | #changelist .actions:last-child { 300 | border-bottom: none; 301 | } 302 | 303 | #changelist .actions select { 304 | vertical-align: top; 305 | height: 24px; 306 | background: none; 307 | color: #000; 308 | border: 1px solid #ccc; 309 | border-radius: 4px; 310 | font-size: 14px; 311 | padding: 0 0 0 4px; 312 | margin: 0; 313 | margin-left: 10px; 314 | } 315 | 316 | #changelist .actions select:focus { 317 | border-color: #999; 318 | } 319 | 320 | #changelist .actions label { 321 | display: inline-block; 322 | vertical-align: middle; 323 | font-size: 13px; 324 | } 325 | 326 | #changelist .actions .button { 327 | font-size: 13px; 328 | border: 1px solid #ccc; 329 | border-radius: 4px; 330 | background: #fff; 331 | box-shadow: 0 -15px 20px -10px rgba(0, 0, 0, 0.15) inset; 332 | cursor: pointer; 333 | height: 24px; 334 | line-height: 1; 335 | padding: 4px 8px; 336 | margin: 0; 337 | color: #333; 338 | } 339 | 340 | #changelist .actions .button:focus, #changelist .actions .button:hover { 341 | border-color: #999; 342 | } 343 | -------------------------------------------------------------------------------- /static/static_prod/admin/css/dashboard.css: -------------------------------------------------------------------------------- 1 | /* DASHBOARD */ 2 | 3 | .dashboard .module table th { 4 | width: 100%; 5 | } 6 | 7 | .dashboard .module table td { 8 | white-space: nowrap; 9 | } 10 | 11 | .dashboard .module table td a { 12 | display: block; 13 | padding-right: .6em; 14 | } 15 | 16 | /* RECENT ACTIONS MODULE */ 17 | 18 | .module ul.actionlist { 19 | margin-left: 0; 20 | } 21 | 22 | ul.actionlist li { 23 | list-style-type: none; 24 | } 25 | 26 | ul.actionlist li { 27 | overflow: hidden; 28 | text-overflow: ellipsis; 29 | -o-text-overflow: ellipsis; 30 | } 31 | -------------------------------------------------------------------------------- /static/static_prod/admin/css/fonts.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'Roboto'; 3 | src: url('../fonts/Roboto-Bold-webfont.woff'); 4 | font-weight: 700; 5 | font-style: normal; 6 | } 7 | 8 | @font-face { 9 | font-family: 'Roboto'; 10 | src: url('../fonts/Roboto-Regular-webfont.woff'); 11 | font-weight: 400; 12 | font-style: normal; 13 | } 14 | 15 | @font-face { 16 | font-family: 'Roboto'; 17 | src: url('../fonts/Roboto-Light-webfont.woff'); 18 | font-weight: 300; 19 | font-style: normal; 20 | } 21 | -------------------------------------------------------------------------------- /static/static_prod/admin/css/forms.css: -------------------------------------------------------------------------------- 1 | @import url('widgets.css'); 2 | 3 | /* FORM ROWS */ 4 | 5 | .form-row { 6 | overflow: hidden; 7 | padding: 10px; 8 | font-size: 13px; 9 | border-bottom: 1px solid #eee; 10 | } 11 | 12 | .form-row img, .form-row input { 13 | vertical-align: middle; 14 | } 15 | 16 | .form-row label input[type="checkbox"] { 17 | margin-top: 0; 18 | vertical-align: 0; 19 | } 20 | 21 | form .form-row p { 22 | padding-left: 0; 23 | } 24 | 25 | .hidden { 26 | display: none; 27 | } 28 | 29 | /* FORM LABELS */ 30 | 31 | label { 32 | font-weight: normal; 33 | color: #666; 34 | font-size: 13px; 35 | } 36 | 37 | .required label, label.required { 38 | font-weight: bold; 39 | color: #333; 40 | } 41 | 42 | /* RADIO BUTTONS */ 43 | 44 | form ul.radiolist li { 45 | list-style-type: none; 46 | } 47 | 48 | form ul.radiolist label { 49 | float: none; 50 | display: inline; 51 | } 52 | 53 | form ul.radiolist input[type="radio"] { 54 | margin: -2px 4px 0 0; 55 | padding: 0; 56 | } 57 | 58 | form ul.inline { 59 | margin-left: 0; 60 | padding: 0; 61 | } 62 | 63 | form ul.inline li { 64 | float: left; 65 | padding-right: 7px; 66 | } 67 | 68 | /* ALIGNED FIELDSETS */ 69 | 70 | .aligned label { 71 | display: block; 72 | padding: 4px 10px 0 0; 73 | float: left; 74 | width: 160px; 75 | word-wrap: break-word; 76 | line-height: 1; 77 | } 78 | 79 | .aligned label:not(.vCheckboxLabel):after { 80 | content: ''; 81 | display: inline-block; 82 | vertical-align: middle; 83 | height: 26px; 84 | } 85 | 86 | .aligned label + p { 87 | padding: 6px 0; 88 | margin-top: 0; 89 | margin-bottom: 0; 90 | margin-left: 170px; 91 | } 92 | 93 | .aligned ul label { 94 | display: inline; 95 | float: none; 96 | width: auto; 97 | } 98 | 99 | .aligned .form-row input { 100 | margin-bottom: 0; 101 | } 102 | 103 | .colMS .aligned .vLargeTextField, .colMS .aligned .vXMLLargeTextField { 104 | width: 350px; 105 | } 106 | 107 | form .aligned ul { 108 | margin-left: 160px; 109 | padding-left: 10px; 110 | } 111 | 112 | form .aligned ul.radiolist { 113 | display: inline-block; 114 | margin: 0; 115 | padding: 0; 116 | } 117 | 118 | form .aligned p.help { 119 | clear: left; 120 | margin-top: 0; 121 | margin-left: 160px; 122 | padding-left: 10px; 123 | } 124 | 125 | form .aligned label + p.help { 126 | margin-left: 0; 127 | padding-left: 0; 128 | } 129 | 130 | form .aligned p.help:last-child { 131 | margin-bottom: 0; 132 | padding-bottom: 0; 133 | } 134 | 135 | form .aligned input + p.help, 136 | form .aligned textarea + p.help, 137 | form .aligned select + p.help { 138 | margin-left: 160px; 139 | padding-left: 10px; 140 | } 141 | 142 | form .aligned ul li { 143 | list-style: none; 144 | } 145 | 146 | form .aligned table p { 147 | margin-left: 0; 148 | padding-left: 0; 149 | } 150 | 151 | .aligned .vCheckboxLabel { 152 | float: none; 153 | width: auto; 154 | display: inline-block; 155 | vertical-align: -3px; 156 | padding: 0 0 5px 5px; 157 | } 158 | 159 | .aligned .vCheckboxLabel + p.help { 160 | margin-top: -4px; 161 | } 162 | 163 | .colM .aligned .vLargeTextField, .colM .aligned .vXMLLargeTextField { 164 | width: 610px; 165 | } 166 | 167 | .checkbox-row p.help { 168 | margin-left: 0; 169 | padding-left: 0; 170 | } 171 | 172 | fieldset .field-box { 173 | float: left; 174 | margin-right: 20px; 175 | } 176 | 177 | /* WIDE FIELDSETS */ 178 | 179 | .wide label { 180 | width: 200px; 181 | } 182 | 183 | form .wide p, form .wide input + p.help { 184 | margin-left: 200px; 185 | } 186 | 187 | form .wide p.help { 188 | padding-left: 38px; 189 | } 190 | 191 | .colM fieldset.wide .vLargeTextField, .colM fieldset.wide .vXMLLargeTextField { 192 | width: 450px; 193 | } 194 | 195 | /* COLLAPSED FIELDSETS */ 196 | 197 | fieldset.collapsed * { 198 | display: none; 199 | } 200 | 201 | fieldset.collapsed h2, fieldset.collapsed { 202 | display: block; 203 | } 204 | 205 | fieldset.collapsed { 206 | border: 1px solid #eee; 207 | border-radius: 4px; 208 | overflow: hidden; 209 | } 210 | 211 | fieldset.collapsed h2 { 212 | background: #f8f8f8; 213 | color: #666; 214 | } 215 | 216 | fieldset .collapse-toggle { 217 | color: #fff; 218 | } 219 | 220 | fieldset.collapsed .collapse-toggle { 221 | background: transparent; 222 | display: inline; 223 | color: #447e9b; 224 | } 225 | 226 | /* MONOSPACE TEXTAREAS */ 227 | 228 | fieldset.monospace textarea { 229 | font-family: "Bitstream Vera Sans Mono", Monaco, "Courier New", Courier, monospace; 230 | } 231 | 232 | /* SUBMIT ROW */ 233 | 234 | .submit-row { 235 | padding: 12px 14px; 236 | margin: 0 0 20px; 237 | background: #f8f8f8; 238 | border: 1px solid #eee; 239 | border-radius: 4px; 240 | text-align: right; 241 | overflow: hidden; 242 | } 243 | 244 | body.popup .submit-row { 245 | overflow: auto; 246 | } 247 | 248 | .submit-row input { 249 | height: 35px; 250 | line-height: 15px; 251 | margin: 0 0 0 5px; 252 | } 253 | 254 | .submit-row input.default { 255 | margin: 0 0 0 8px; 256 | text-transform: uppercase; 257 | } 258 | 259 | .submit-row p { 260 | margin: 0.3em; 261 | } 262 | 263 | .submit-row p.deletelink-box { 264 | float: left; 265 | margin: 0; 266 | } 267 | 268 | .submit-row a.deletelink { 269 | display: block; 270 | background: #ba2121; 271 | border-radius: 4px; 272 | padding: 10px 15px; 273 | height: 15px; 274 | line-height: 15px; 275 | color: #fff; 276 | } 277 | 278 | .submit-row a.deletelink:focus, 279 | .submit-row a.deletelink:hover, 280 | .submit-row a.deletelink:active { 281 | background: #a41515; 282 | } 283 | 284 | /* CUSTOM FORM FIELDS */ 285 | 286 | .vSelectMultipleField { 287 | vertical-align: top; 288 | } 289 | 290 | .vCheckboxField { 291 | border: none; 292 | } 293 | 294 | .vDateField, .vTimeField { 295 | margin-right: 2px; 296 | margin-bottom: 4px; 297 | } 298 | 299 | .vDateField { 300 | min-width: 6.85em; 301 | } 302 | 303 | .vTimeField { 304 | min-width: 4.7em; 305 | } 306 | 307 | .vURLField { 308 | width: 30em; 309 | } 310 | 311 | .vLargeTextField, .vXMLLargeTextField { 312 | width: 48em; 313 | } 314 | 315 | .flatpages-flatpage #id_content { 316 | height: 40.2em; 317 | } 318 | 319 | .module table .vPositiveSmallIntegerField { 320 | width: 2.2em; 321 | } 322 | 323 | .vTextField { 324 | width: 20em; 325 | } 326 | 327 | .vIntegerField { 328 | width: 5em; 329 | } 330 | 331 | .vBigIntegerField { 332 | width: 10em; 333 | } 334 | 335 | .vForeignKeyRawIdAdminField { 336 | width: 5em; 337 | } 338 | 339 | /* INLINES */ 340 | 341 | .inline-group { 342 | padding: 0; 343 | margin: 0 0 30px; 344 | } 345 | 346 | .inline-group thead th { 347 | padding: 8px 10px; 348 | } 349 | 350 | .inline-group .aligned label { 351 | width: 160px; 352 | } 353 | 354 | .inline-related { 355 | position: relative; 356 | } 357 | 358 | .inline-related h3 { 359 | margin: 0; 360 | color: #666; 361 | padding: 5px; 362 | font-size: 13px; 363 | background: #f8f8f8; 364 | border-top: 1px solid #eee; 365 | border-bottom: 1px solid #eee; 366 | } 367 | 368 | .inline-related h3 span.delete { 369 | float: right; 370 | } 371 | 372 | .inline-related h3 span.delete label { 373 | margin-left: 2px; 374 | font-size: 11px; 375 | } 376 | 377 | .inline-related fieldset { 378 | margin: 0; 379 | background: #fff; 380 | border: none; 381 | width: 100%; 382 | } 383 | 384 | .inline-related fieldset.module h3 { 385 | margin: 0; 386 | padding: 2px 5px 3px 5px; 387 | font-size: 11px; 388 | text-align: left; 389 | font-weight: bold; 390 | background: #bcd; 391 | color: #fff; 392 | } 393 | 394 | .inline-group .tabular fieldset.module { 395 | border: none; 396 | } 397 | 398 | .inline-related.tabular fieldset.module table { 399 | width: 100%; 400 | } 401 | 402 | .last-related fieldset { 403 | border: none; 404 | } 405 | 406 | .inline-group .tabular tr.has_original td { 407 | padding-top: 2em; 408 | } 409 | 410 | .inline-group .tabular tr td.original { 411 | padding: 2px 0 0 0; 412 | width: 0; 413 | _position: relative; 414 | } 415 | 416 | .inline-group .tabular th.original { 417 | width: 0px; 418 | padding: 0; 419 | } 420 | 421 | .inline-group .tabular td.original p { 422 | position: absolute; 423 | left: 0; 424 | height: 1.1em; 425 | padding: 2px 9px; 426 | overflow: hidden; 427 | font-size: 9px; 428 | font-weight: bold; 429 | color: #666; 430 | _width: 700px; 431 | } 432 | 433 | .inline-group ul.tools { 434 | padding: 0; 435 | margin: 0; 436 | list-style: none; 437 | } 438 | 439 | .inline-group ul.tools li { 440 | display: inline; 441 | padding: 0 5px; 442 | } 443 | 444 | .inline-group div.add-row, 445 | .inline-group .tabular tr.add-row td { 446 | color: #666; 447 | background: #f8f8f8; 448 | padding: 8px 10px; 449 | border-bottom: 1px solid #eee; 450 | } 451 | 452 | .inline-group .tabular tr.add-row td { 453 | padding: 8px 10px; 454 | border-bottom: 1px solid #eee; 455 | } 456 | 457 | .inline-group ul.tools a.add, 458 | .inline-group div.add-row a, 459 | .inline-group .tabular tr.add-row td a { 460 | background: url(../img/icon-addlink.svg) 0 1px no-repeat; 461 | padding-left: 16px; 462 | font-size: 12px; 463 | } 464 | 465 | .empty-form { 466 | display: none; 467 | } 468 | 469 | /* RELATED FIELD ADD ONE / LOOKUP */ 470 | 471 | .add-another, .related-lookup { 472 | margin-left: 5px; 473 | display: inline-block; 474 | vertical-align: middle; 475 | background-repeat: no-repeat; 476 | background-size: 14px; 477 | } 478 | 479 | .add-another { 480 | width: 16px; 481 | height: 16px; 482 | background-image: url(../img/icon-addlink.svg); 483 | } 484 | 485 | .related-lookup { 486 | width: 16px; 487 | height: 16px; 488 | background-image: url(../img/search.svg); 489 | } 490 | 491 | form .related-widget-wrapper ul { 492 | display: inline-block; 493 | margin-left: 0; 494 | padding-left: 0; 495 | } 496 | 497 | .clearable-file-input input { 498 | margin-top: 0; 499 | } 500 | -------------------------------------------------------------------------------- /static/static_prod/admin/css/login.css: -------------------------------------------------------------------------------- 1 | /* LOGIN FORM */ 2 | 3 | body.login { 4 | background: #f8f8f8; 5 | } 6 | 7 | .login #header { 8 | height: auto; 9 | padding: 5px 16px; 10 | } 11 | 12 | .login #header h1 { 13 | font-size: 18px; 14 | } 15 | 16 | .login #header h1 a { 17 | color: #fff; 18 | } 19 | 20 | .login #content { 21 | padding: 20px 20px 0; 22 | } 23 | 24 | .login #container { 25 | background: #fff; 26 | border: 1px solid #eaeaea; 27 | border-radius: 4px; 28 | overflow: hidden; 29 | width: 28em; 30 | min-width: 300px; 31 | margin: 100px auto; 32 | } 33 | 34 | .login #content-main { 35 | width: 100%; 36 | } 37 | 38 | .login .form-row { 39 | padding: 4px 0; 40 | float: left; 41 | width: 100%; 42 | border-bottom: none; 43 | } 44 | 45 | .login .form-row label { 46 | padding-right: 0.5em; 47 | line-height: 2em; 48 | font-size: 1em; 49 | clear: both; 50 | color: #333; 51 | } 52 | 53 | .login .form-row #id_username, .login .form-row #id_password { 54 | clear: both; 55 | padding: 8px; 56 | width: 100%; 57 | -webkit-box-sizing: border-box; 58 | -moz-box-sizing: border-box; 59 | box-sizing: border-box; 60 | } 61 | 62 | .login span.help { 63 | font-size: 10px; 64 | display: block; 65 | } 66 | 67 | .login .submit-row { 68 | clear: both; 69 | padding: 1em 0 0 9.4em; 70 | margin: 0; 71 | border: none; 72 | background: none; 73 | text-align: left; 74 | } 75 | 76 | .login .password-reset-link { 77 | text-align: center; 78 | } 79 | -------------------------------------------------------------------------------- /static/static_prod/admin/css/rtl.css: -------------------------------------------------------------------------------- 1 | body { 2 | direction: rtl; 3 | } 4 | 5 | /* LOGIN */ 6 | 7 | .login .form-row { 8 | float: right; 9 | } 10 | 11 | .login .form-row label { 12 | float: right; 13 | padding-left: 0.5em; 14 | padding-right: 0; 15 | text-align: left; 16 | } 17 | 18 | .login .submit-row { 19 | clear: both; 20 | padding: 1em 9.4em 0 0; 21 | } 22 | 23 | /* GLOBAL */ 24 | 25 | th { 26 | text-align: right; 27 | } 28 | 29 | .module h2, .module caption { 30 | text-align: right; 31 | } 32 | 33 | .module ul, .module ol { 34 | margin-left: 0; 35 | margin-right: 1.5em; 36 | } 37 | 38 | .addlink, .changelink { 39 | padding-left: 0; 40 | padding-right: 16px; 41 | background-position: 100% 1px; 42 | } 43 | 44 | .deletelink { 45 | padding-left: 0; 46 | padding-right: 16px; 47 | background-position: 100% 1px; 48 | } 49 | 50 | .object-tools { 51 | float: left; 52 | } 53 | 54 | thead th:first-child, 55 | tfoot td:first-child { 56 | border-left: none; 57 | } 58 | 59 | /* LAYOUT */ 60 | 61 | #user-tools { 62 | right: auto; 63 | left: 0; 64 | text-align: left; 65 | } 66 | 67 | div.breadcrumbs { 68 | text-align: right; 69 | } 70 | 71 | #content-main { 72 | float: right; 73 | } 74 | 75 | #content-related { 76 | float: left; 77 | margin-left: -300px; 78 | margin-right: auto; 79 | } 80 | 81 | .colMS { 82 | margin-left: 300px; 83 | margin-right: 0; 84 | } 85 | 86 | /* SORTABLE TABLES */ 87 | 88 | table thead th.sorted .sortoptions { 89 | float: left; 90 | } 91 | 92 | thead th.sorted .text { 93 | padding-right: 0; 94 | padding-left: 42px; 95 | } 96 | 97 | /* dashboard styles */ 98 | 99 | .dashboard .module table td a { 100 | padding-left: .6em; 101 | padding-right: 16px; 102 | } 103 | 104 | /* changelists styles */ 105 | 106 | .change-list .filtered table { 107 | border-left: none; 108 | border-right: 0px none; 109 | } 110 | 111 | #changelist-filter { 112 | right: auto; 113 | left: 0; 114 | border-left: none; 115 | border-right: none; 116 | } 117 | 118 | .change-list .filtered .results, .change-list .filtered .paginator, .filtered #toolbar, .filtered div.xfull { 119 | margin-right: 0; 120 | margin-left: 280px; 121 | } 122 | 123 | #changelist-filter li.selected { 124 | border-left: none; 125 | padding-left: 10px; 126 | margin-left: 0; 127 | border-right: 5px solid #eaeaea; 128 | padding-right: 10px; 129 | margin-right: -15px; 130 | } 131 | 132 | .filtered .actions { 133 | margin-left: 280px; 134 | margin-right: 0; 135 | } 136 | 137 | #changelist table tbody td:first-child, #changelist table tbody th:first-child { 138 | border-right: none; 139 | border-left: none; 140 | } 141 | 142 | /* FORMS */ 143 | 144 | .aligned label { 145 | padding: 0 0 3px 1em; 146 | float: right; 147 | } 148 | 149 | .submit-row { 150 | text-align: left 151 | } 152 | 153 | .submit-row p.deletelink-box { 154 | float: right; 155 | } 156 | 157 | .submit-row input.default { 158 | margin-left: 0; 159 | } 160 | 161 | .vDateField, .vTimeField { 162 | margin-left: 2px; 163 | } 164 | 165 | .aligned .form-row input { 166 | margin-left: 5px; 167 | } 168 | 169 | form ul.inline li { 170 | float: right; 171 | padding-right: 0; 172 | padding-left: 7px; 173 | } 174 | 175 | input[type=submit].default, .submit-row input.default { 176 | float: left; 177 | } 178 | 179 | fieldset .field-box { 180 | float: right; 181 | margin-left: 20px; 182 | margin-right: 0; 183 | } 184 | 185 | .errorlist li { 186 | background-position: 100% 12px; 187 | padding: 0; 188 | } 189 | 190 | .errornote { 191 | background-position: 100% 12px; 192 | padding: 10px 12px; 193 | } 194 | 195 | /* WIDGETS */ 196 | 197 | .calendarnav-previous { 198 | top: 0; 199 | left: auto; 200 | right: 10px; 201 | } 202 | 203 | .calendarnav-next { 204 | top: 0; 205 | right: auto; 206 | left: 10px; 207 | } 208 | 209 | .calendar caption, .calendarbox h2 { 210 | text-align: center; 211 | } 212 | 213 | .selector { 214 | float: right; 215 | } 216 | 217 | .selector .selector-filter { 218 | text-align: right; 219 | } 220 | 221 | .inline-deletelink { 222 | float: left; 223 | } 224 | 225 | form .form-row p.datetime { 226 | overflow: hidden; 227 | } 228 | 229 | /* MISC */ 230 | 231 | .inline-related h2, .inline-group h2 { 232 | text-align: right 233 | } 234 | 235 | .inline-related h3 span.delete { 236 | padding-right: 20px; 237 | padding-left: inherit; 238 | left: 10px; 239 | right: inherit; 240 | float:left; 241 | } 242 | 243 | .inline-related h3 span.delete label { 244 | margin-left: inherit; 245 | margin-right: 2px; 246 | } 247 | 248 | /* IE7 specific bug fixes */ 249 | 250 | div.colM { 251 | position: relative; 252 | } 253 | 254 | .submit-row input { 255 | float: left; 256 | } 257 | -------------------------------------------------------------------------------- /static/static_prod/admin/fonts/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /static/static_prod/admin/fonts/README.txt: -------------------------------------------------------------------------------- 1 | Roboto webfont source: https://www.google.com/fonts/specimen/Roboto 2 | Weights used in this project: Light (300), Regular (400), Bold (700) 3 | -------------------------------------------------------------------------------- /static/static_prod/admin/fonts/Roboto-Bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/static_prod/admin/fonts/Roboto-Bold-webfont.woff -------------------------------------------------------------------------------- /static/static_prod/admin/fonts/Roboto-Light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/static_prod/admin/fonts/Roboto-Light-webfont.woff -------------------------------------------------------------------------------- /static/static_prod/admin/fonts/Roboto-Regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/static_prod/admin/fonts/Roboto-Regular-webfont.woff -------------------------------------------------------------------------------- /static/static_prod/admin/img/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Code Charm Ltd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/README.txt: -------------------------------------------------------------------------------- 1 | All icons are taken from Font Awesome (http://fontawesome.io/) project. 2 | The Font Awesome font is licensed under the SIL OFL 1.1: 3 | - http://scripts.sil.org/OFL 4 | 5 | SVG icons source: https://github.com/encharm/Font-Awesome-SVG-PNG 6 | Font-Awesome-SVG-PNG is licensed under the MIT license (see file license 7 | in current folder). 8 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/calendar-icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/gis/move_vertex_off.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/gis/move_vertex_on.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/icon-addlink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/icon-alert.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/icon-calendar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/icon-changelink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/icon-clock.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/icon-deletelink.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/icon-no.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/icon-unknown-alt.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/icon-unknown.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/icon-yes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/inline-delete.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/selector-icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/sorting-icons.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/tooltag-add.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/img/tooltag-arrowright.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /static/static_prod/admin/js/SelectBox.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | 'use strict'; 3 | var SelectBox = { 4 | cache: {}, 5 | init: function(id) { 6 | var box = document.getElementById(id); 7 | var node; 8 | SelectBox.cache[id] = []; 9 | var cache = SelectBox.cache[id]; 10 | var boxOptions = box.options; 11 | var boxOptionsLength = boxOptions.length; 12 | for (var i = 0, j = boxOptionsLength; i < j; i++) { 13 | node = boxOptions[i]; 14 | cache.push({value: node.value, text: node.text, displayed: 1}); 15 | } 16 | }, 17 | redisplay: function(id) { 18 | // Repopulate HTML select box from cache 19 | var box = document.getElementById(id); 20 | var node; 21 | $(box).empty(); // clear all options 22 | var new_options = box.outerHTML.slice(0, -9); // grab just the opening tag 23 | var cache = SelectBox.cache[id]; 24 | for (var i = 0, j = cache.length; i < j; i++) { 25 | node = cache[i]; 26 | if (node.displayed) { 27 | var new_option = new Option(node.text, node.value, false, false); 28 | // Shows a tooltip when hovering over the option 29 | new_option.setAttribute("title", node.text); 30 | new_options += new_option.outerHTML; 31 | } 32 | } 33 | new_options += ''; 34 | box.outerHTML = new_options; 35 | }, 36 | filter: function(id, text) { 37 | // Redisplay the HTML select box, displaying only the choices containing ALL 38 | // the words in text. (It's an AND search.) 39 | var tokens = text.toLowerCase().split(/\s+/); 40 | var node, token; 41 | var cache = SelectBox.cache[id]; 42 | for (var i = 0, j = cache.length; i < j; i++) { 43 | node = cache[i]; 44 | node.displayed = 1; 45 | var node_text = node.text.toLowerCase(); 46 | var numTokens = tokens.length; 47 | for (var k = 0; k < numTokens; k++) { 48 | token = tokens[k]; 49 | if (node_text.indexOf(token) === -1) { 50 | node.displayed = 0; 51 | break; // Once the first token isn't found we're done 52 | } 53 | } 54 | } 55 | SelectBox.redisplay(id); 56 | }, 57 | delete_from_cache: function(id, value) { 58 | var node, delete_index = null; 59 | var cache = SelectBox.cache[id]; 60 | for (var i = 0, j = cache.length; i < j; i++) { 61 | node = cache[i]; 62 | if (node.value === value) { 63 | delete_index = i; 64 | break; 65 | } 66 | } 67 | cache.splice(delete_index, 1); 68 | }, 69 | add_to_cache: function(id, option) { 70 | SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1}); 71 | }, 72 | cache_contains: function(id, value) { 73 | // Check if an item is contained in the cache 74 | var node; 75 | var cache = SelectBox.cache[id]; 76 | for (var i = 0, j = cache.length; i < j; i++) { 77 | node = cache[i]; 78 | if (node.value === value) { 79 | return true; 80 | } 81 | } 82 | return false; 83 | }, 84 | move: function(from, to) { 85 | var from_box = document.getElementById(from); 86 | var option; 87 | var boxOptions = from_box.options; 88 | var boxOptionsLength = boxOptions.length; 89 | for (var i = 0, j = boxOptionsLength; i < j; i++) { 90 | option = boxOptions[i]; 91 | var option_value = option.value; 92 | if (option.selected && SelectBox.cache_contains(from, option_value)) { 93 | SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1}); 94 | SelectBox.delete_from_cache(from, option_value); 95 | } 96 | } 97 | SelectBox.redisplay(from); 98 | SelectBox.redisplay(to); 99 | }, 100 | move_all: function(from, to) { 101 | var from_box = document.getElementById(from); 102 | var option; 103 | var boxOptions = from_box.options; 104 | var boxOptionsLength = boxOptions.length; 105 | for (var i = 0, j = boxOptionsLength; i < j; i++) { 106 | option = boxOptions[i]; 107 | var option_value = option.value; 108 | if (SelectBox.cache_contains(from, option_value)) { 109 | SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1}); 110 | SelectBox.delete_from_cache(from, option_value); 111 | } 112 | } 113 | SelectBox.redisplay(from); 114 | SelectBox.redisplay(to); 115 | }, 116 | sort: function(id) { 117 | SelectBox.cache[id].sort(function(a, b) { 118 | a = a.text.toLowerCase(); 119 | b = b.text.toLowerCase(); 120 | try { 121 | if (a > b) { 122 | return 1; 123 | } 124 | if (a < b) { 125 | return -1; 126 | } 127 | } 128 | catch (e) { 129 | // silently fail on IE 'unknown' exception 130 | } 131 | return 0; 132 | } ); 133 | }, 134 | select_all: function(id) { 135 | var box = document.getElementById(id); 136 | var boxOptions = box.options; 137 | var boxOptionsLength = boxOptions.length; 138 | for (var i = 0; i < boxOptionsLength; i++) { 139 | boxOptions[i].selected = 'selected'; 140 | } 141 | } 142 | }; 143 | window.SelectBox = SelectBox; 144 | })(django.jQuery); 145 | -------------------------------------------------------------------------------- /static/static_prod/admin/js/actions.js: -------------------------------------------------------------------------------- 1 | /*global gettext, interpolate, ngettext*/ 2 | (function($) { 3 | 'use strict'; 4 | var lastChecked; 5 | 6 | $.fn.actions = function(opts) { 7 | var options = $.extend({}, $.fn.actions.defaults, opts); 8 | var actionCheckboxes = $(this); 9 | var list_editable_changed = false; 10 | var showQuestion = function() { 11 | $(options.acrossClears).hide(); 12 | $(options.acrossQuestions).show(); 13 | $(options.allContainer).hide(); 14 | }, 15 | showClear = function() { 16 | $(options.acrossClears).show(); 17 | $(options.acrossQuestions).hide(); 18 | $(options.actionContainer).toggleClass(options.selectedClass); 19 | $(options.allContainer).show(); 20 | $(options.counterContainer).hide(); 21 | }, 22 | reset = function() { 23 | $(options.acrossClears).hide(); 24 | $(options.acrossQuestions).hide(); 25 | $(options.allContainer).hide(); 26 | $(options.counterContainer).show(); 27 | }, 28 | clearAcross = function() { 29 | reset(); 30 | $(options.acrossInput).val(0); 31 | $(options.actionContainer).removeClass(options.selectedClass); 32 | }, 33 | checker = function(checked) { 34 | if (checked) { 35 | showQuestion(); 36 | } else { 37 | reset(); 38 | } 39 | $(actionCheckboxes).prop("checked", checked) 40 | .parent().parent().toggleClass(options.selectedClass, checked); 41 | }, 42 | updateCounter = function() { 43 | var sel = $(actionCheckboxes).filter(":checked").length; 44 | // data-actions-icnt is defined in the generated HTML 45 | // and contains the total amount of objects in the queryset 46 | var actions_icnt = $('.action-counter').data('actionsIcnt'); 47 | $(options.counterContainer).html(interpolate( 48 | ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), { 49 | sel: sel, 50 | cnt: actions_icnt 51 | }, true)); 52 | $(options.allToggle).prop("checked", function() { 53 | var value; 54 | if (sel === actionCheckboxes.length) { 55 | value = true; 56 | showQuestion(); 57 | } else { 58 | value = false; 59 | clearAcross(); 60 | } 61 | return value; 62 | }); 63 | }; 64 | // Show counter by default 65 | $(options.counterContainer).show(); 66 | // Check state of checkboxes and reinit state if needed 67 | $(this).filter(":checked").each(function(i) { 68 | $(this).parent().parent().toggleClass(options.selectedClass); 69 | updateCounter(); 70 | if ($(options.acrossInput).val() === 1) { 71 | showClear(); 72 | } 73 | }); 74 | $(options.allToggle).show().click(function() { 75 | checker($(this).prop("checked")); 76 | updateCounter(); 77 | }); 78 | $("a", options.acrossQuestions).click(function(event) { 79 | event.preventDefault(); 80 | $(options.acrossInput).val(1); 81 | showClear(); 82 | }); 83 | $("a", options.acrossClears).click(function(event) { 84 | event.preventDefault(); 85 | $(options.allToggle).prop("checked", false); 86 | clearAcross(); 87 | checker(0); 88 | updateCounter(); 89 | }); 90 | lastChecked = null; 91 | $(actionCheckboxes).click(function(event) { 92 | if (!event) { event = window.event; } 93 | var target = event.target ? event.target : event.srcElement; 94 | if (lastChecked && $.data(lastChecked) !== $.data(target) && event.shiftKey === true) { 95 | var inrange = false; 96 | $(lastChecked).prop("checked", target.checked) 97 | .parent().parent().toggleClass(options.selectedClass, target.checked); 98 | $(actionCheckboxes).each(function() { 99 | if ($.data(this) === $.data(lastChecked) || $.data(this) === $.data(target)) { 100 | inrange = (inrange) ? false : true; 101 | } 102 | if (inrange) { 103 | $(this).prop("checked", target.checked) 104 | .parent().parent().toggleClass(options.selectedClass, target.checked); 105 | } 106 | }); 107 | } 108 | $(target).parent().parent().toggleClass(options.selectedClass, target.checked); 109 | lastChecked = target; 110 | updateCounter(); 111 | }); 112 | $('form#changelist-form table#result_list tr').find('td:gt(0) :input').change(function() { 113 | list_editable_changed = true; 114 | }); 115 | $('form#changelist-form button[name="index"]').click(function(event) { 116 | if (list_editable_changed) { 117 | return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost.")); 118 | } 119 | }); 120 | $('form#changelist-form input[name="_save"]').click(function(event) { 121 | var action_changed = false; 122 | $('select option:selected', options.actionContainer).each(function() { 123 | if ($(this).val()) { 124 | action_changed = true; 125 | } 126 | }); 127 | if (action_changed) { 128 | if (list_editable_changed) { 129 | return confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")); 130 | } else { 131 | return confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button.")); 132 | } 133 | } 134 | }); 135 | }; 136 | /* Setup plugin defaults */ 137 | $.fn.actions.defaults = { 138 | actionContainer: "div.actions", 139 | counterContainer: "span.action-counter", 140 | allContainer: "div.actions span.all", 141 | acrossInput: "div.actions input.select-across", 142 | acrossQuestions: "div.actions span.question", 143 | acrossClears: "div.actions span.clear", 144 | allToggle: "#action-toggle", 145 | selectedClass: "selected" 146 | }; 147 | $(document).ready(function() { 148 | var $actionsEls = $('tr input.action-select'); 149 | if ($actionsEls.length > 0) { 150 | $actionsEls.actions(); 151 | } 152 | }); 153 | })(django.jQuery); 154 | -------------------------------------------------------------------------------- /static/static_prod/admin/js/actions.min.js: -------------------------------------------------------------------------------- 1 | (function(a){var f;a.fn.actions=function(e){var b=a.extend({},a.fn.actions.defaults,e),g=a(this),k=!1,l=function(){a(b.acrossClears).hide();a(b.acrossQuestions).show();a(b.allContainer).hide()},m=function(){a(b.acrossClears).show();a(b.acrossQuestions).hide();a(b.actionContainer).toggleClass(b.selectedClass);a(b.allContainer).show();a(b.counterContainer).hide()},n=function(){a(b.acrossClears).hide();a(b.acrossQuestions).hide();a(b.allContainer).hide();a(b.counterContainer).show()},p=function(){n(); 2 | a(b.acrossInput).val(0);a(b.actionContainer).removeClass(b.selectedClass)},q=function(c){c?l():n();a(g).prop("checked",c).parent().parent().toggleClass(b.selectedClass,c)},h=function(){var c=a(g).filter(":checked").length,d=a(".action-counter").data("actionsIcnt");a(b.counterContainer).html(interpolate(ngettext("%(sel)s of %(cnt)s selected","%(sel)s of %(cnt)s selected",c),{sel:c,cnt:d},!0));a(b.allToggle).prop("checked",function(){var a;c===g.length?(a=!0,l()):(a=!1,p());return a})};a(b.counterContainer).show(); 3 | a(this).filter(":checked").each(function(c){a(this).parent().parent().toggleClass(b.selectedClass);h();1===a(b.acrossInput).val()&&m()});a(b.allToggle).show().click(function(){q(a(this).prop("checked"));h()});a("a",b.acrossQuestions).click(function(c){c.preventDefault();a(b.acrossInput).val(1);m()});a("a",b.acrossClears).click(function(c){c.preventDefault();a(b.allToggle).prop("checked",!1);p();q(0);h()});f=null;a(g).click(function(c){c||(c=window.event);var d=c.target?c.target:c.srcElement;if(f&& 4 | a.data(f)!==a.data(d)&&!0===c.shiftKey){var e=!1;a(f).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked);a(g).each(function(){if(a.data(this)===a.data(f)||a.data(this)===a.data(d))e=e?!1:!0;e&&a(this).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked)})}a(d).parent().parent().toggleClass(b.selectedClass,d.checked);f=d;h()});a("form#changelist-form table#result_list tr").find("td:gt(0) :input").change(function(){k=!0});a('form#changelist-form button[name="index"]').click(function(a){if(k)return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."))}); 5 | a('form#changelist-form input[name="_save"]').click(function(c){var d=!1;a("select option:selected",b.actionContainer).each(function(){a(this).val()&&(d=!0)});if(d)return k?confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")):confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."))})}; 6 | a.fn.actions.defaults={actionContainer:"div.actions",counterContainer:"span.action-counter",allContainer:"div.actions span.all",acrossInput:"div.actions input.select-across",acrossQuestions:"div.actions span.question",acrossClears:"div.actions span.clear",allToggle:"#action-toggle",selectedClass:"selected"};a(document).ready(function(){var e=a("tr input.action-select");0' + gettext("Show") + 11 | ')'); 12 | } 13 | }); 14 | // Add toggle to anchor tag 15 | $("fieldset.collapse a.collapse-toggle").click(function(ev) { 16 | if ($(this).closest("fieldset").hasClass("collapsed")) { 17 | // Show 18 | $(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset", [$(this).attr("id")]); 19 | } else { 20 | // Hide 21 | $(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", [$(this).attr("id")]); 22 | } 23 | return false; 24 | }); 25 | }); 26 | })(django.jQuery); 27 | -------------------------------------------------------------------------------- /static/static_prod/admin/js/collapse.min.js: -------------------------------------------------------------------------------- 1 | (function(a){a(document).ready(function(){a("fieldset.collapse").each(function(b,c){0===a(c).find("div.errors").length&&a(c).addClass("collapsed").find("h2").first().append(' ('+gettext("Show")+")")});a("fieldset.collapse a.collapse-toggle").click(function(b){a(this).closest("fieldset").hasClass("collapsed")?a(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset",[a(this).attr("id")]):a(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", 2 | [a(this).attr("id")]);return!1})})})(django.jQuery); 3 | -------------------------------------------------------------------------------- /static/static_prod/admin/js/core.js: -------------------------------------------------------------------------------- 1 | // Core javascript helper functions 2 | 3 | // basic browser identification & version 4 | var isOpera = (navigator.userAgent.indexOf("Opera") >= 0) && parseFloat(navigator.appVersion); 5 | var isIE = ((document.all) && (!isOpera)) && parseFloat(navigator.appVersion.split("MSIE ")[1].split(";")[0]); 6 | 7 | // Cross-browser event handlers. 8 | function addEvent(obj, evType, fn) { 9 | 'use strict'; 10 | if (obj.addEventListener) { 11 | obj.addEventListener(evType, fn, false); 12 | return true; 13 | } else if (obj.attachEvent) { 14 | var r = obj.attachEvent("on" + evType, fn); 15 | return r; 16 | } else { 17 | return false; 18 | } 19 | } 20 | 21 | function removeEvent(obj, evType, fn) { 22 | 'use strict'; 23 | if (obj.removeEventListener) { 24 | obj.removeEventListener(evType, fn, false); 25 | return true; 26 | } else if (obj.detachEvent) { 27 | obj.detachEvent("on" + evType, fn); 28 | return true; 29 | } else { 30 | return false; 31 | } 32 | } 33 | 34 | function cancelEventPropagation(e) { 35 | 'use strict'; 36 | if (!e) { 37 | e = window.event; 38 | } 39 | e.cancelBubble = true; 40 | if (e.stopPropagation) { 41 | e.stopPropagation(); 42 | } 43 | } 44 | 45 | // quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]); 46 | function quickElement() { 47 | 'use strict'; 48 | var obj = document.createElement(arguments[0]); 49 | if (arguments[2]) { 50 | var textNode = document.createTextNode(arguments[2]); 51 | obj.appendChild(textNode); 52 | } 53 | var len = arguments.length; 54 | for (var i = 3; i < len; i += 2) { 55 | obj.setAttribute(arguments[i], arguments[i + 1]); 56 | } 57 | arguments[1].appendChild(obj); 58 | return obj; 59 | } 60 | 61 | // "a" is reference to an object 62 | function removeChildren(a) { 63 | 'use strict'; 64 | while (a.hasChildNodes()) { 65 | a.removeChild(a.lastChild); 66 | } 67 | } 68 | 69 | // ---------------------------------------------------------------------------- 70 | // Find-position functions by PPK 71 | // See http://www.quirksmode.org/js/findpos.html 72 | // ---------------------------------------------------------------------------- 73 | function findPosX(obj) { 74 | 'use strict'; 75 | var curleft = 0; 76 | if (obj.offsetParent) { 77 | while (obj.offsetParent) { 78 | curleft += obj.offsetLeft - ((isOpera) ? 0 : obj.scrollLeft); 79 | obj = obj.offsetParent; 80 | } 81 | // IE offsetParent does not include the top-level 82 | if (isIE && obj.parentElement) { 83 | curleft += obj.offsetLeft - obj.scrollLeft; 84 | } 85 | } else if (obj.x) { 86 | curleft += obj.x; 87 | } 88 | return curleft; 89 | } 90 | 91 | function findPosY(obj) { 92 | 'use strict'; 93 | var curtop = 0; 94 | if (obj.offsetParent) { 95 | while (obj.offsetParent) { 96 | curtop += obj.offsetTop - ((isOpera) ? 0 : obj.scrollTop); 97 | obj = obj.offsetParent; 98 | } 99 | // IE offsetParent does not include the top-level 100 | if (isIE && obj.parentElement) { 101 | curtop += obj.offsetTop - obj.scrollTop; 102 | } 103 | } else if (obj.y) { 104 | curtop += obj.y; 105 | } 106 | return curtop; 107 | } 108 | 109 | //----------------------------------------------------------------------------- 110 | // Date object extensions 111 | // ---------------------------------------------------------------------------- 112 | (function() { 113 | 'use strict'; 114 | Date.prototype.getTwelveHours = function() { 115 | var hours = this.getHours(); 116 | if (hours === 0) { 117 | return 12; 118 | } 119 | else { 120 | return hours <= 12 ? hours : hours - 12; 121 | } 122 | }; 123 | 124 | Date.prototype.getTwoDigitMonth = function() { 125 | return (this.getMonth() < 9) ? '0' + (this.getMonth() + 1) : (this.getMonth() + 1); 126 | }; 127 | 128 | Date.prototype.getTwoDigitDate = function() { 129 | return (this.getDate() < 10) ? '0' + this.getDate() : this.getDate(); 130 | }; 131 | 132 | Date.prototype.getTwoDigitTwelveHour = function() { 133 | return (this.getTwelveHours() < 10) ? '0' + this.getTwelveHours() : this.getTwelveHours(); 134 | }; 135 | 136 | Date.prototype.getTwoDigitHour = function() { 137 | return (this.getHours() < 10) ? '0' + this.getHours() : this.getHours(); 138 | }; 139 | 140 | Date.prototype.getTwoDigitMinute = function() { 141 | return (this.getMinutes() < 10) ? '0' + this.getMinutes() : this.getMinutes(); 142 | }; 143 | 144 | Date.prototype.getTwoDigitSecond = function() { 145 | return (this.getSeconds() < 10) ? '0' + this.getSeconds() : this.getSeconds(); 146 | }; 147 | 148 | Date.prototype.getHourMinute = function() { 149 | return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute(); 150 | }; 151 | 152 | Date.prototype.getHourMinuteSecond = function() { 153 | return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute() + ':' + this.getTwoDigitSecond(); 154 | }; 155 | 156 | Date.prototype.getFullMonthName = function() { 157 | return typeof window.CalendarNamespace === "undefined" 158 | ? this.getTwoDigitMonth() 159 | : window.CalendarNamespace.monthsOfYear[this.getMonth()]; 160 | }; 161 | 162 | Date.prototype.strftime = function(format) { 163 | var fields = { 164 | B: this.getFullMonthName(), 165 | c: this.toString(), 166 | d: this.getTwoDigitDate(), 167 | H: this.getTwoDigitHour(), 168 | I: this.getTwoDigitTwelveHour(), 169 | m: this.getTwoDigitMonth(), 170 | M: this.getTwoDigitMinute(), 171 | p: (this.getHours() >= 12) ? 'PM' : 'AM', 172 | S: this.getTwoDigitSecond(), 173 | w: '0' + this.getDay(), 174 | x: this.toLocaleDateString(), 175 | X: this.toLocaleTimeString(), 176 | y: ('' + this.getFullYear()).substr(2, 4), 177 | Y: '' + this.getFullYear(), 178 | '%': '%' 179 | }; 180 | var result = '', i = 0; 181 | while (i < format.length) { 182 | if (format.charAt(i) === '%') { 183 | result = result + fields[format.charAt(i + 1)]; 184 | ++i; 185 | } 186 | else { 187 | result = result + format.charAt(i); 188 | } 189 | ++i; 190 | } 191 | return result; 192 | }; 193 | 194 | // ---------------------------------------------------------------------------- 195 | // String object extensions 196 | // ---------------------------------------------------------------------------- 197 | String.prototype.pad_left = function(pad_length, pad_string) { 198 | var new_string = this; 199 | for (var i = 0; new_string.length < pad_length; i++) { 200 | new_string = pad_string + new_string; 201 | } 202 | return new_string; 203 | }; 204 | 205 | String.prototype.strptime = function(format) { 206 | var split_format = format.split(/[.\-/]/); 207 | var date = this.split(/[.\-/]/); 208 | var i = 0; 209 | var day, month, year; 210 | while (i < split_format.length) { 211 | switch (split_format[i]) { 212 | case "%d": 213 | day = date[i]; 214 | break; 215 | case "%m": 216 | month = date[i] - 1; 217 | break; 218 | case "%Y": 219 | year = date[i]; 220 | break; 221 | case "%y": 222 | year = date[i]; 223 | break; 224 | } 225 | ++i; 226 | } 227 | // Create Date object from UTC since the parsed value is supposed to be 228 | // in UTC, not local time. Also, the calendar uses UTC functions for 229 | // date extraction. 230 | return new Date(Date.UTC(year, month, day)); 231 | }; 232 | 233 | })(); 234 | // ---------------------------------------------------------------------------- 235 | // Get the computed style for and element 236 | // ---------------------------------------------------------------------------- 237 | function getStyle(oElm, strCssRule) { 238 | 'use strict'; 239 | var strValue = ""; 240 | if(document.defaultView && document.defaultView.getComputedStyle) { 241 | strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule); 242 | } 243 | else if(oElm.currentStyle) { 244 | strCssRule = strCssRule.replace(/\-(\w)/g, function(strMatch, p1) { 245 | return p1.toUpperCase(); 246 | }); 247 | strValue = oElm.currentStyle[strCssRule]; 248 | } 249 | return strValue; 250 | } 251 | -------------------------------------------------------------------------------- /static/static_prod/admin/js/inlines.min.js: -------------------------------------------------------------------------------- 1 | (function(c){c.fn.formset=function(b){var a=c.extend({},c.fn.formset.defaults,b),d=c(this);b=d.parent();var k=function(a,g,l){var b=new RegExp("("+g+"-(\\d+|__prefix__))");g=g+"-"+l;c(a).prop("for")&&c(a).prop("for",c(a).prop("for").replace(b,g));a.id&&(a.id=a.id.replace(b,g));a.name&&(a.name=a.name.replace(b,g))},e=c("#id_"+a.prefix+"-TOTAL_FORMS").prop("autocomplete","off"),l=parseInt(e.val(),10),g=c("#id_"+a.prefix+"-MAX_NUM_FORMS").prop("autocomplete","off"),h=""===g.val()||0'+a.addText+""),m=b.find("tr:last a")):(d.filter(":last").after('"),m=d.filter(":last").next().find("a"));m.click(function(b){b.preventDefault();b=c("#"+a.prefix+"-empty");var f=b.clone(!0);f.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id", 3 | a.prefix+"-"+l);f.is("tr")?f.children(":last").append('
    '+a.deleteText+"
    "):f.is("ul")||f.is("ol")?f.append('
  • '+a.deleteText+"
  • "):f.children(":first").append(''+a.deleteText+"");f.find("*").each(function(){k(this,a.prefix,e.val())});f.insertBefore(c(b));c(e).val(parseInt(e.val(),10)+1);l+=1;""!==g.val()&&0>=g.val()-e.val()&&m.parent().hide(); 4 | f.find("a."+a.deleteCssClass).click(function(b){b.preventDefault();f.remove();--l;a.removed&&a.removed(f);c(document).trigger("formset:removed",[f,a.prefix]);b=c("."+a.formCssClass);c("#id_"+a.prefix+"-TOTAL_FORMS").val(b.length);(""===g.val()||0 0) { 26 | values.push(field.val()); 27 | } 28 | }); 29 | prepopulatedField.val(URLify(values.join(' '), maxLength, allowUnicode)); 30 | }; 31 | 32 | prepopulatedField.data('_changed', false); 33 | prepopulatedField.change(function() { 34 | prepopulatedField.data('_changed', true); 35 | }); 36 | 37 | if (!prepopulatedField.val()) { 38 | $(dependencies.join(',')).keyup(populate).change(populate).focus(populate); 39 | } 40 | }); 41 | }; 42 | })(django.jQuery); 43 | -------------------------------------------------------------------------------- /static/static_prod/admin/js/prepopulate.min.js: -------------------------------------------------------------------------------- 1 | (function(c){c.fn.prepopulate=function(e,f,g){return this.each(function(){var a=c(this),b=function(){if(!a.data("_changed")){var b=[];c.each(e,function(a,d){d=c(d);0 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /static/static_prod/css/landing.css: -------------------------------------------------------------------------------- 1 | html, body{ 2 | height: 100%; 3 | max-height: 100%; 4 | font-family: 'Roboto', sans-serif; 5 | } 6 | 7 | .top-container{ 8 | padding-top: 10%; 9 | } 10 | 11 | .general-container{ 12 | background: url('../img/bg_image.jpg'); 13 | height: 100%; 14 | } 15 | 16 | .general-container form{ 17 | margin-top: 30px; 18 | } 19 | 20 | .general-container form label{ 21 | font-weight: 100; 22 | color: white; 23 | } 24 | 25 | .btn-orange{ 26 | background-color: #e8643e; 27 | border: none; 28 | } 29 | 30 | .btn-orange:hover{ 31 | background-color: #dc5129; 32 | border: none; 33 | } 34 | 35 | .title{ 36 | text-align: center; 37 | color: white; 38 | font-weight: 100; 39 | line-height: 50px; 40 | } -------------------------------------------------------------------------------- /static/static_prod/css/style.css: -------------------------------------------------------------------------------- 1 | html, body{ 2 | height: 100%; 3 | max-height: 100%; 4 | font-family: 'Roboto', sans-serif; 5 | background-color: #edeef0; 6 | } 7 | 8 | .navbar{ 9 | margin-bottom: 0; 10 | } 11 | 12 | .wrapper{ 13 | min-height: 100%; 14 | } 15 | 16 | .wrapper-content{ 17 | overflow: auto; 18 | padding-bottom: 180px; /* must be same height as the footer */ 19 | } 20 | 21 | .footer{ 22 | position: relative; 23 | margin-top: -180px; /* negative value of footer height */ 24 | height: 180px; 25 | clear: both; 26 | background-color: white; 27 | } 28 | 29 | .section-top{ 30 | margin-bottom: 20px 31 | } 32 | 33 | .product-description-tabs{ 34 | padding: 10px; 35 | } 36 | 37 | .section{ 38 | padding: 50px 0; 39 | } 40 | 41 | .section h1{ 42 | margin-bottom: 40px; 43 | } 44 | 45 | .product-item{ 46 | height: 360px; 47 | background-color: white; 48 | border: 1px solid lightgrey; 49 | position: relative; 50 | padding: 10px 0 10px 0; 51 | text-align: center; 52 | margin-bottom: 10px; 53 | } 54 | 55 | .add-to-card-btn{ 56 | position: absolute; 57 | bottom: 15px; 58 | left: 50%; 59 | transform: translateX(-50%); 60 | } 61 | 62 | .discount-container{ 63 | position: absolute; 64 | top: 30%; 65 | background: #55e073; 66 | width: 30%; 67 | color: white; 68 | font-weight: 700; 69 | padding: 3px; 70 | } 71 | 72 | .section-delivery{ 73 | height: 300px; 74 | background-color: darkseagreen; 75 | text-align: center; 76 | color: white; 77 | } 78 | 79 | .product-image-item{ 80 | padding: 5px; 81 | margin-bottom: 5px; 82 | } 83 | 84 | .navbar-top{ 85 | min-height: 10px; 86 | height: 20px; 87 | background-color: green; 88 | border: none; 89 | border-radius: 0; 90 | } 91 | 92 | .navbar-main{ 93 | background-color: #55e073; 94 | border: none; 95 | border-radius: 0; 96 | } 97 | 98 | .basket-container{ 99 | position: relative; 100 | width: 400px; 101 | padding: 15px 10px; 102 | } 103 | 104 | .basket-items{ 105 | position: absolute; 106 | top: 50px; 107 | width: 100%; 108 | background-color: #55e093; 109 | z-index: 10; 110 | padding: 10px; 111 | } 112 | 113 | .form-error{ 114 | color: red; 115 | } -------------------------------------------------------------------------------- /static/static_prod/img/bg_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/static_prod/img/bg_image.jpg -------------------------------------------------------------------------------- /static/static_prod/img/slider0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/static/static_prod/img/slider0.jpg -------------------------------------------------------------------------------- /static/static_prod/js/scripts.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | var form = $('#form_buying_product'); 3 | console.log(form); 4 | 5 | 6 | function basketUpdating(product_id, nmb, is_delete){ 7 | var data = {}; 8 | data.product_id = product_id; 9 | data.nmb = nmb; 10 | var csrf_token = $('#form_buying_product [name="csrfmiddlewaretoken"]').val(); 11 | data["csrfmiddlewaretoken"] = csrf_token; 12 | 13 | if (is_delete){ 14 | data["is_delete"] = true; 15 | } 16 | 17 | var url = form.attr("action"); 18 | 19 | console.log(data) 20 | $.ajax({ 21 | url: url, 22 | type: 'POST', 23 | data: data, 24 | cache: true, 25 | success: function (data) { 26 | console.log("OK"); 27 | console.log(data.products_total_nmb); 28 | if (data.products_total_nmb || data.products_total_nmb == 0){ 29 | $('#basket_total_nmb').text("("+data.products_total_nmb+")"); 30 | console.log(data.products); 31 | $('.basket-items ul').html(""); 32 | $.each(data.products, function(k, v){ 33 | $('.basket-items ul').append('
  • '+ v.name+', ' + v.nmb + 'шт. ' + 'по ' + v.price_per_item + 'грн ' + 34 | 'x'+ 35 | '
  • '); 36 | }); 37 | } 38 | 39 | }, 40 | error: function(){ 41 | console.log("error") 42 | } 43 | }) 44 | 45 | } 46 | 47 | form.on('submit', function(e){ 48 | e.preventDefault(); 49 | console.log('123'); 50 | var nmb = $('#number').val(); 51 | console.log(nmb); 52 | var submit_btn = $('#submit_btn'); 53 | var product_id = submit_btn.data("product_id"); 54 | var name = submit_btn.data("name"); 55 | var price = submit_btn.data("price"); 56 | console.log(product_id ); 57 | console.log(name); 58 | 59 | basketUpdating(product_id, nmb, is_delete=false) 60 | 61 | }); 62 | 63 | function showingBasket(){ 64 | $('.basket-items').removeClass('hidden'); 65 | }; 66 | 67 | //$('.basket-container').on('click', function(e){ 68 | // e.preventDefault(); 69 | // showingBasket(); 70 | //}); 71 | 72 | $('.basket-container').mouseover(function(){ 73 | showingBasket(); 74 | }); 75 | 76 | //$('.basket-container').mouseout(function(){ 77 | // showingBasket(); 78 | //}); 79 | 80 | $(document).on('click', '.delete-item', function(e){ 81 | e.preventDefault(); 82 | product_id = $(this).data("product_id") 83 | nmb = 0; 84 | basketUpdating(product_id, nmb, is_delete=true) 85 | }); 86 | 87 | function calculatingBasketAmount(){ 88 | var total_order_amount = 0; 89 | $('.total-product-in-basket-amount').each(function() { 90 | total_order_amount = total_order_amount + parseFloat($(this).text()); 91 | }); 92 | console.log(total_order_amount); 93 | $('#total_order_amount').text(total_order_amount.toFixed(2)); 94 | }; 95 | 96 | $(document).on('change', ".product-in-basket-nmb", function(){ 97 | var current_nmb = $(this).val(); 98 | console.log(current_nmb); 99 | 100 | var current_tr = $(this).closest('tr'); 101 | var current_price = parseFloat(current_tr.find('.product-price').text()).toFixed(2); 102 | console.log(current_price); 103 | var total_amount = parseFloat(current_nmb*current_price).toFixed(2); 104 | console.log(total_amount); 105 | current_tr.find('.total-product-in-basket-amount').text(total_amount); 106 | 107 | calculatingBasketAmount(); 108 | }); 109 | 110 | 111 | calculatingBasketAmount(); 112 | 113 | }); -------------------------------------------------------------------------------- /templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | Title 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
    22 |
    23 | {% include 'navbar.html' %} 24 | 25 | {% block content %} 26 | {% endblock content %} 27 |
    28 | 29 |
    30 | 31 | {% include 'footer.html' %} 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /templates/footer.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 |

    FOOTER

    5 |
    6 |
    7 |
    -------------------------------------------------------------------------------- /templates/landing/home.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | 5 | {% block content %} 6 |
    7 | 8 |
    9 |
    10 |
    11 |
    12 |
    13 |

    14 | Новые поступления 15 |

    16 |
    17 | {% for product_image in products_images %} 18 | {% include 'landing/product_item.html' %} 19 | {% endfor %} 20 |
    21 |
    22 |
    23 |
    24 |
    25 |

    Free shipping

    26 |
    27 |
    28 |
    29 |
    30 |
    31 |
    32 |

    33 | Телефоны 34 |

    35 |
    36 | {% for product_image in products_images_phones %} 37 | {% include 'landing/product_item.html' %} 38 | {% endfor %} 39 | 40 |
    41 |
    42 |
    43 |
    44 |
    45 |
    46 |
    47 |

    48 | Ноутбуки 49 |

    50 |
    51 | {% for product_image in products_images_laptops %} 52 | {% include 'landing/product_item.html' %} 53 | {% endfor %} 54 | 55 |
    56 |
    57 |
    58 | {% endblock %} -------------------------------------------------------------------------------- /templates/landing/landing.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 6 | 7 | Title 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
    22 |
    23 |
    24 |
    25 |

    Наш магазин скоро откроется!
    26 | Оставляйте Ваш имейл в форме ниже

    27 |
    28 |
    {% csrf_token %} 29 |
    30 | 31 | 32 |
    33 |
    34 | 35 | 36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 |
    43 |
    44 |
    45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /templates/landing/product_item.html: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |
    4 | 5 | 6 | 7 |
    8 | 9 | {% if product_image.product.discount %} 10 |
    11 | {{ product_image.product.discount }}% 12 |
    13 | {% endif %} 14 | 15 |

    {{ product_image.product.name }}

    16 |

    17 | {{ product_image.product.description|truncatechars_html:70 }} 18 |

    19 |
    20 | {{ product_image.product.price }} UAH 21 |
    22 |
    23 | 26 |
    27 |
    28 |
    -------------------------------------------------------------------------------- /templates/navbar.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /templates/orders/checkout.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | 5 | {% block content %} 6 |
    7 |
    8 | {% if products_in_basket %} 9 |
    10 |

    Товары в корзине

    11 |
    Общая стоимость: {{ request.session.basket.total_amount }} грн
    12 | {{ request.session.basket.products }} 13 | 14 |
    {% csrf_token %} 15 | 16 |
    17 |
    18 | 19 | {{ form.name.errors }} 20 | 23 |
    24 |
    25 | 26 |
    27 |
    28 | 29 | {{ form.phone.errors }} 30 | 33 |
    34 |
    35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | {% for product_in_basket in products_in_basket %} 48 | 49 | 52 | 56 | 61 | 66 | 67 | {% endfor %} 68 | 69 |
    Название товараКоличествоЦена за еденицуОбщая цена
    50 | {{ product_in_basket.product.name }} 51 | 53 | 55 | 57 | 58 | {{ product_in_basket.price_per_item}} 59 | 60 | 62 | 63 | {{ product_in_basket.total_price }} 64 | 65 |
    70 | 71 |
    72 | Сумма заказа: 54 73 |
    74 | 75 |
    76 | 77 |
    78 | 79 |
    80 | 81 |
    82 | 83 |
    84 | {% else %} 85 |

    В Вашей корзине нет товаров

    86 | {% endif %} 87 | 88 |
    89 |
    90 | {% endblock %} 91 | -------------------------------------------------------------------------------- /templates/products/product.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | {% load static %} 3 | 4 | 5 | {% block content %} 6 |
    7 |
    8 |
    9 | {% for image_item in product.productimage_set.all %} 10 |
    11 | 12 |
    13 | {% endfor %} 14 |
    15 |
    16 |

    17 | {{ product.name }} 18 |

    19 |
    20 |

    21 | Price: {{ product.price }} 22 |

    23 |
    24 |
    25 | 26 | 40 | 41 | 42 |
    43 |
    44 | {{ product.description }} 45 |
    46 |
    47 |

    Как мы делаем доставку

    48 |
    49 |
    ...
    50 |
    ...
    51 |
    52 |
    53 |
    54 |
    {% csrf_token %} 55 |
    56 | 57 |
    58 | 59 | 60 |
    61 | 68 |
    69 | 70 |
    71 |
    72 |
    73 |
    74 |
    75 | {% endblock %} -------------------------------------------------------------------------------- /test_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codingmedved/shop/154705bcb25798db327d73401026d9f6b22c0cc3/test_project/__init__.py -------------------------------------------------------------------------------- /test_project/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for test_project project. 3 | 4 | Generated by 'django-admin startproject' using Django 1.10.4. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.10/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/1.10/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = '=ty$^@5c8omf@ulm$5*ui!we6u%a2fo6uc2+hq@f&amod()l8l' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 41 | 'landing', 42 | 'products', 43 | 'orders', 44 | ] 45 | 46 | 47 | MIDDLEWARE = [ 48 | 'django.middleware.security.SecurityMiddleware', 49 | 'django.contrib.sessions.middleware.SessionMiddleware', 50 | 'django.middleware.common.CommonMiddleware', 51 | 'django.middleware.csrf.CsrfViewMiddleware', 52 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 53 | 'django.contrib.messages.middleware.MessageMiddleware', 54 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 55 | ] 56 | 57 | ROOT_URLCONF = 'test_project.urls' 58 | 59 | TEMPLATES = [ 60 | { 61 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 62 | 'DIRS': [os.path.join(BASE_DIR, 'templates')] 63 | , 64 | 'APP_DIRS': True, 65 | 'OPTIONS': { 66 | 'context_processors': [ 67 | 'django.template.context_processors.debug', 68 | 'django.template.context_processors.request', 69 | 'django.contrib.auth.context_processors.auth', 70 | 'django.contrib.messages.context_processors.messages', 71 | 72 | 'orders.context_processors.getting_basket_info', 73 | ], 74 | }, 75 | }, 76 | ] 77 | 78 | WSGI_APPLICATION = 'test_project.wsgi.application' 79 | 80 | 81 | # Database 82 | # https://docs.djangoproject.com/en/1.10/ref/settings/#databases 83 | 84 | DATABASES = { 85 | 'default': { 86 | 'ENGINE': 'django.db.backends.sqlite3', 87 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 88 | } 89 | } 90 | 91 | 92 | # Password validation 93 | # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators 94 | 95 | AUTH_PASSWORD_VALIDATORS = [ 96 | { 97 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 98 | }, 99 | { 100 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 101 | }, 102 | { 103 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 104 | }, 105 | { 106 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 107 | }, 108 | ] 109 | 110 | 111 | # Internationalization 112 | # https://docs.djangoproject.com/en/1.10/topics/i18n/ 113 | 114 | LANGUAGE_CODE = 'en-us' 115 | 116 | TIME_ZONE = 'UTC' 117 | 118 | USE_I18N = True 119 | 120 | USE_L10N = True 121 | 122 | USE_TZ = True 123 | 124 | 125 | # Static files (CSS, JavaScript, Images) 126 | # https://docs.djangoproject.com/en/1.10/howto/static-files/ 127 | 128 | STATIC_URL = '/static/' 129 | 130 | STATICFILES_DIRS = ( 131 | os.path.join(BASE_DIR, "static", "static_dev"), 132 | ) 133 | 134 | 135 | STATIC_ROOT = os.path.join(BASE_DIR, "static", "static_prod") 136 | 137 | MEDIA_URL = '/media/' 138 | 139 | MEDIA_ROOT = os.path.join(BASE_DIR, "static", "media") 140 | 141 | #uncomment 142 | try: 143 | from .settings_prod import * 144 | except: 145 | pass -------------------------------------------------------------------------------- /test_project/settings_prod1.py: -------------------------------------------------------------------------------- 1 | DEBUG = False 2 | ALLOWED_HOSTS = ['*'] 3 | 4 | #settings for db on server 5 | DATABASES = { 6 | 'default': { 7 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 8 | 'NAME': 'db1', 9 | 'USER': 'django_shop', 10 | 'PASSWORD': 'django_shop_test', 11 | 'HOST': 'localhost', 12 | 'PORT': '', # Set to empty string for default. 13 | } 14 | } -------------------------------------------------------------------------------- /test_project/urls.py: -------------------------------------------------------------------------------- 1 | """test_project URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/1.10/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.conf.urls import url, include 14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url, include 17 | from django.contrib import admin 18 | from django.conf import settings 19 | from django.conf.urls.static import static 20 | 21 | 22 | urlpatterns = [ 23 | url(r'^admin/', admin.site.urls), 24 | url(r'^', include('landing.urls')), 25 | url(r'^', include('products.urls')), 26 | url(r'^', include('orders.urls')), 27 | ] \ 28 | + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) \ 29 | + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 30 | -------------------------------------------------------------------------------- /test_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for test_project project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /utils/main.py: -------------------------------------------------------------------------------- 1 | from functools import wraps 2 | 3 | def disable_for_loaddata(signal_handler): 4 | """ 5 | Decorator that turns off signal handlers when loading fixture data. 6 | """ 7 | @wraps(signal_handler) 8 | def wrapper(*args, **kwargs): 9 | if kwargs['raw']: 10 | return 11 | signal_handler(*args, **kwargs) 12 | return wrapper --------------------------------------------------------------------------------