Init Django-SHOP

This commit is contained in:
2021-02-23 22:57:30 +00:00
parent 8842939839
commit b4a79a6890
109 changed files with 5734 additions and 160 deletions

5
.coveragerc Normal file
View File

@@ -0,0 +1,5 @@
[run]
include = weird-little-empire/*
omit = *migrations*, *tests*
plugins =
django_coverage_plugin

29
.editorconfig Normal file
View File

@@ -0,0 +1,29 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{py,rst,ini}]
indent_style = space
indent_size = 4
[*.py]
line_length = 119
known_first_party = my-shop
multi_line_output = 3
default_section = THIRDPARTY
[*.{html,js,rst,scss}]
indent_style = tab
indent_size = 4
[*.md]
trim_trailing_whitespace = false
[*.txt]
insert_final_newline = false

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* text=auto

168
.gitignore vendored
View File

@@ -1,140 +1,34 @@
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
*.pyc
.project
.pydevproject
.settings
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
*.coverage
*~
private_settings.py
build
docs/_build
docs/web_build
dist
*egg-info*
htmlcov
test-reports
bin/
include/
lib/
distribute*
share/
*.sqlite
database.db
*.swp
.DS_store
*coverage.xml
.idea
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
OLD-out-of-date
.tox
node_modules/
workdir/
django-shop-workdir_*
.pytest_cache/

14
.pylintrc Normal file
View File

@@ -0,0 +1,14 @@
[MASTER]
load-plugins=pylint_common, pylint_django
[FORMAT]
max-line-length=120
[MESSAGES CONTROL]
disable=missing-docstring,invalid-name
[DESIGN]
max-parents=13
[TYPECHECK]
generated-members=REQUEST,acl_users,aq_parent,"[a-zA-Z]+_set{1,2}",save,delete

11
.travis.yml Normal file
View File

@@ -0,0 +1,11 @@
sudo: true
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq build-essential gettext python-dev zlib1g-dev libpq-dev xvfb
- sudo apt-get install -qq libtiff4-dev libjpeg8-dev libfreetype6-dev liblcms1-dev libwebp-dev
- sudo apt-get install -qq graphviz-dev python-setuptools python3-dev python-virtualenv python-pip
- sudo apt-get install -qq firefox automake libtool libreadline6 libreadline6-dev libreadline-dev
- sudo apt-get install -qq libsqlite3-dev libxml2 libxml2-dev libssl-dev libbz2-dev wget curl llvm
language: python
python:
- "3.6"

46
Pipfile
View File

@@ -1,16 +1,50 @@
[[source]]
url = "https://pypi.org/simple"
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
shuup = "*"
django = "*"
django-tailwind = "*"
Django = ">=3"
django-compressor = "*"
django-allauth = "*"
django-angular = ">=2.3"
django-filer = "*"
django-bootstrap3 = "*"
django-ipware = "*"
django-sass-processor = "*"
django-select2 = "*"
django-filter = "*"
djangorestframework = "*"
django-rest-auth = "*"
django-polymorphic = ">=2.1"
django-admin-sortable2 = "*"
django-fsm = "*"
django-fsm-admin = "*"
django-phonenumber-field = "*"
django-post_office = "*"
phonenumbers = "*"
django-cms = ">=3.7.2"
djangocms-bootstrap = "*"
djangocms-cascade = ">=1.3.1"
djangocms-text-ckeditor = ">=3.9.1"
libsass = "*"
django-shop = ">=1.2.1"
django-elasticsearch-dsl = "*"
elasticsearch-dsl = ">=7"
djangoshop-stripe = ">=1.2"
stripe = "<2"
[dev-packages]
tox = "*"
pytest = "*"
pytest-django = "*"
beautifulsoup4 = "*"
lxml = "*"
factory-boy = "*"
pytest-factoryboy = "*"
[requires]
python_version = "3.9"
python_version = "3.7"
[pipenv]
allow_prereleases = true

View File

@@ -1,2 +1,4 @@
# empire
# Weird Little Empire
This project is the merchant implementation for django-SHOP. It has been generated by this
[cookiecutter template](https://github.com/awesto/cookiecutter-django-shop).

153
docs/Makefile Normal file
View File

@@ -0,0 +1,153 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/weird-little-empire.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/weird-little-empire.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/weird-little-empire"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/weird-little-empire"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."

1
docs/__init__.py Normal file
View File

@@ -0,0 +1 @@
# Included so that Django's startproject comment runs against the docs directory

255
docs/conf.py Normal file
View File

@@ -0,0 +1,255 @@
# Weird Little Empire documentation build configuration file, created by
# sphinx-quickstart.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# The suffix of source filenames.
source_suffix = ".rst"
# The encoding of source files.
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = "index"
# General information about the project.
project = "Weird Little Empire"
copyright = """2021, A Jones"""
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "0.1"
# The full version, including alpha/beta/rc tags.
release = "0.1"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build"]
# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "default"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}
# If false, no module index is generated.
# html_domain_indices = True
# If false, no index is generated.
# html_use_index = True
# If true, the index is split into individual pages for each letter.
# html_split_index = False
# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = "weird-little-empiredoc"
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
# 'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
(
"index",
"weird-little-empire.tex",
"Weird Little Empire Documentation",
"""A Jones""",
"manual",
)
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
# latex_use_parts = False
# If true, show page references after internal links.
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
# latex_appendices = []
# If false, no module index is generated.
# latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(
"index",
"weird-little-empire",
"Weird Little Empire Documentation",
["""A Jones"""],
1,
)
]
# If true, show URL addresses after external links.
# man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
"index",
"weird-little-empire",
"Weird Little Empire Documentation",
"""A Jones""",
"Weird Little Empire",
"""Oddities from the black heart of the Old World""",
"Miscellaneous",
)
]
# Documents to append as an appendix to all manuals.
# texinfo_appendices = []
# If false, no module index is generated.
# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
# texinfo_show_urls = 'footnote'

4
docs/deploy.rst Normal file
View File

@@ -0,0 +1,4 @@
Deploy
========
This is where you describe how the project is deployed in production.

186
docs/docker_ec2.rst Normal file
View File

@@ -0,0 +1,186 @@
Developing with Docker
======================
You can develop your application in a `Docker`_ container for simpler deployment onto bare Linux machines later. This instruction assumes an `Amazon Web Services`_ EC2 instance, but it should work on any machine with Docker > 1.3 and `Docker compose`_ installed.
.. _Docker: https://www.docker.com/
.. _Amazon Web Services: http://aws.amazon.com/
.. _Docker compose: https://docs.docker.com/compose/
Setting up
^^^^^^^^^^
Docker encourages running one container for each process. This might mean one container for your web server, one for Django application and a third for your database. Once you're happy composing containers in this way you can easily add more, such as a `Redis`_ cache.
.. _Redis: http://redis.io/
The Docker compose tool (previously known as `fig`_) makes linking these containers easy. An example set up for your Cookiecutter Django project might look like this:
.. _fig: http://www.fig.sh/
::
webapp/ # Your cookiecutter project would be in here
Dockerfile
...
database/
Dockerfile
...
webserver/
Dockerfile
...
production.yml
Each component of your application would get its own `Dockerfile`_. The rest of this example assumes you are using the `base postgres image`_ for your database. Your database settings in `config/base.py` might then look something like:
.. _Dockerfile: https://docs.docker.com/reference/builder/
.. _base postgres image: https://registry.hub.docker.com/_/postgres/
.. code-block:: python
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'HOST': 'database',
'PORT': 5432,
}
}
The `Docker compose documentation`_ explains in detail what you can accomplish in the `production.yml` file, but an example configuration might look like this:
.. _Docker compose documentation: https://docs.docker.com/compose/#compose-documentation
.. code-block:: yaml
database:
build: database
webapp:
build: webapp:
command: /usr/bin/python3.6 manage.py runserver 0.0.0.0:8000 # dev setting
# command: gunicorn -b 0.0.0.0:8000 wsgi:application # production setting
volumes:
- webapp/your_project_name:/path/to/container/workdir/
links:
- database
webserver:
build: webserver
ports:
- "80:80"
- "443:443"
links:
- webapp
We'll ignore the webserver for now (you'll want to comment that part out while we do). A working Dockerfile to run your cookiecutter application might look like this:
::
FROM ubuntu:14.04
ENV REFRESHED_AT 2015-01-13
# update packages and prepare to build software
RUN ["apt-get", "update"]
RUN ["apt-get", "-y", "install", "build-essential", "vim", "git", "curl"]
RUN ["locale-gen", "en_GB.UTF-8"]
# install latest python
RUN ["apt-get", "-y", "build-dep", "python3-dev", "python3-imaging"]
RUN ["apt-get", "-y", "install", "python3-dev", "python3-imaging", "python3-pip"]
# prepare postgreSQL support
RUN ["apt-get", "-y", "build-dep", "python3-psycopg2"]
# move into our working directory
# ADD must be after chown see http://stackoverflow.com/a/26145444/1281947
RUN ["groupadd", "python"]
RUN ["useradd", "python", "-s", "/bin/bash", "-m", "-g", "python", "-G", "python"]
ENV HOME /home/python
WORKDIR /home/python
RUN ["chown", "-R", "python:python", "/home/python"]
ADD ./ /home/python
# manage requirements
ENV REQUIREMENTS_REFRESHED_AT 2015-02-25
RUN ["pip3", "install", "-r", "requirements.txt"]
# uncomment the line below to use container as a non-root user
USER python:python
Running `sudo docker-compose -f production.yml build` will follow the instructions in your `production.yml` file and build the database container, then your webapp, before mounting your cookiecutter project files as a volume in the webapp container and linking to the database. Our example yaml file runs in development mode but changing it to production mode is as simple as commenting out the line using `runserver` and uncommenting the line using `gunicorn`.
Both are set to run on port `0.0.0.0:8000`, which is where the Docker daemon will discover it. You can now run `sudo docker-compose -f production.yml up` and browse to `localhost:8000` to see your application running.
Deployment
^^^^^^^^^^
You'll need a webserver container for deployment. An example setup for `Nginx`_ might look like this:
.. _Nginx: http://wiki.nginx.org/Main
::
FROM ubuntu:14.04
ENV REFRESHED_AT 2015-02-11
# get the nginx package and set it up
RUN ["apt-get", "update"]
RUN ["apt-get", "-y", "install", "nginx"]
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log
VOLUME ["/var/cache/nginx"]
EXPOSE 80 443
# load nginx conf
ADD ./site.conf /etc/nginx/sites-available/your_cookiecutter_project
RUN ["ln", "-s", "/etc/nginx/sites-available/your_cookiecutter_project", "/etc/nginx/sites-enabled/your_cookiecutter_project"]
RUN ["rm", "-rf", "/etc/nginx/sites-available/default"]
#start the server
CMD ["nginx", "-g", "daemon off;"]
That Dockerfile assumes you have an Nginx conf file named `site.conf` in the same directory as the webserver Dockerfile. A very basic example, which forwards traffic onto the development server or gunicorn for processing, would look like this:
::
# see http://serverfault.com/questions/577370/how-can-i-use-environment-variables-in-nginx-conf#comment730384_577370
upstream localhost {
server webapp_1:8000;
}
server {
location / {
proxy_pass http://localhost;
}
}
Running `sudo docker-compose -f production.yml build webserver` will build your server container. Running `sudo docker-compose -f production.yml up` will now expose your application directly on `localhost` (no need to specify the port number).
Building and running your app on EC2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
All you now need to do to run your app in production is:
* Create an empty EC2 Linux instance (any Linux machine should do).
* Install your preferred source control solution, Docker and Docker compose on the news instance.
* Pull in your code from source control. The root directory should be the one with your `production.yml` file in it.
* Run `sudo docker-compose -f production.yml build` and `sudo docker-compose -f production.yml up`.
* Assign an `Elastic IP address`_ to your new machine.
.. _Elastic IP address: https://aws.amazon.com/articles/1346
* Point your domain name to the elastic IP.
**Be careful with Elastic IPs** because, on the AWS free tier, if you assign one and then stop the machine you will incur charges while the machine is down (presumably because you're preventing them allocating the IP to someone else).
Security advisory
^^^^^^^^^^^^^^^^^
The setup described in this instruction will get you up-and-running but it hasn't been audited for security. If you are running your own setup like this it is always advisable to, at a minimum, examine your application with a tool like `OWASP ZAP`_ to see what security holes you might be leaving open.
.. _OWASP ZAP: https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project

26
docs/index.rst Normal file
View File

@@ -0,0 +1,26 @@
.. Weird Little Empire documentation master file, created by
sphinx-quickstart.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Weird Little Empire's documentation!
====================================================================
Contents:
.. toctree::
:maxdepth: 2
install
deploy
docker_ec2
tests
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

4
docs/install.rst Normal file
View File

@@ -0,0 +1,4 @@
Install
=========
This is where you write how to get a new laptop to run this project.

190
docs/make.bat Normal file
View File

@@ -0,0 +1,190 @@
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\weird-little-empire.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\weird-little-empire.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
:end

View File

@@ -0,0 +1,64 @@
Docker Remote Debugging
=======================
To connect to python remote interpreter inside docker, you have to make sure first, that Pycharm is aware of your docker.
Go to *Settings > Build, Execution, Deployment > Docker*. If you are on linux, you can use docker directly using its socket `unix:///var/run/docker.sock`, if you are on Windows or Mac, make sure that you have docker-machine installed, then you can simply *Import credentials from Docker Machine*.
.. image:: images/1.png
Configure Remote Python Interpreter
-----------------------------------
This repository comes with already prepared "Run/Debug Configurations" for docker.
.. image:: images/2.png
But as you can see, at the beggining there is something wrong with them. They have red X on django icon, and they cannot be used, without configuring remote python interpteter. To do that, you have to go to *Settings > Build, Execution, Deployment* first.
Next, you have to add new remote python interpreter, based on already tested deployment settings. Go to *Settings > Project > Project Interpreter*. Click on the cog icon, and click *Add Remote*.
.. image:: images/3.png
Switch to *Docker Compose* and select `local.yml` file from directory of your project, next set *Service name* to `django`
.. image:: images/4.png
Having that, click *OK*. Close *Settings* panel, and wait few seconds...
.. image:: images/7.png
After few seconds, all *Run/Debug Configurations* should be ready to use.
.. image:: images/8.png
**Things you can do with provided configuration**:
* run and debug python code
.. image:: images/f1.png
* run and debug tests
.. image:: images/f2.png
.. image:: images/f3.png
* run and debug migrations or different django management commands
.. image:: images/f4.png
* and many others..
Known issues
------------
* Pycharm hangs on "Connecting to Debugger"
.. image:: images/issue1.png
This might be fault of your firewall. Take a look on this ticket - https://youtrack.jetbrains.com/issue/PY-18913
* Modified files in `.idea` directory
Most of the files from `.idea/` were added to `.gitignore` with a few exceptions, which were made, to provide "ready to go" configuration. After adding remote interpreter some of these files are altered by PyCharm:
.. image:: images/issue2.png
In theory you can remove them from repository, but then, other people will lose a ability to initialize a project from provided configurations as you did. To get rid of this annoying state, you can run command::
$ git update-index --assume-unchanged weird-little-empire.iml

BIN
docs/pycharm/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
docs/pycharm/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
docs/pycharm/images/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

BIN
docs/pycharm/images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
docs/pycharm/images/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
docs/pycharm/images/8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
docs/pycharm/images/f1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

BIN
docs/pycharm/images/f2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

BIN
docs/pycharm/images/f3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

BIN
docs/pycharm/images/f4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

3
dumpdata.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
mkdir -p workdir/fixtures
./manage.py dumpdata --indent=2 --natural-foreign email_auth cmsplugin_cascade.cascadeclipboard cmsplugin_cascade.pluginextrafields cmsplugin_cascade.sharedglossary filer post_office.emailtemplate shop --exclude filer.clipboard --exclude filer.clipboarditem > workdir/fixtures/skeleton.json

6
locale/README.rst Normal file
View File

@@ -0,0 +1,6 @@
Translations
============
Translations will be placed in this folder when running::
python manage.py makemessages

View File

@@ -1,21 +1,10 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'weirdlittleempire.settings')
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)

24
package.json Normal file
View File

@@ -0,0 +1,24 @@
{
"name": "weird-little-empire",
"version": "1.0.0",
"description": "Oddities from the black heart of the Old World",
"private": true,
"dependencies": {
"angular": "^1.7.8",
"angular-animate": "^1.7.8",
"angular-bootstrap-plus": "^0.8.1",
"angular-i18n": "^1.7.8",
"angular-inview": "^3.0.0",
"angular-sanitize": "^1.7.8",
"angular-ui-bootstrap": "~2.5.6",
"autoprefixer": "^8.0.0",
"bootstrap": "^4.3.1",
"font-awesome": "^4.7.0",
"leaflet": "^1.1.0",
"leaflet-easybutton": "^2.2.0",
"postcss": "^6.0.23",
"postcss-cli": "^5.0.0",
"select2": "~4.0.3",
"ui-bootstrap4": "^3.0.5"
}
}

3
pytest.ini Normal file
View File

@@ -0,0 +1,3 @@
[pytest]
DJANGO_SETTINGS_MODULE=config.settings.test
norecursedirs = node_modules

7
setup.cfg Normal file
View File

@@ -0,0 +1,7 @@
[flake8]
max-line-length = 120
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
[pycodestyle]
max-line-length = 120
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules

View File

@@ -0,0 +1,2 @@
__version__ = '0.0.1'
default_app_config = 'weirdlittleempire.apps.WeirdLittleEmpire'

130
weirdlittleempire/admin.py Normal file
View File

@@ -0,0 +1,130 @@
from django.contrib import admin
from django.template.context import Context
from django.template.loader import get_template
from django.utils.translation import ugettext_lazy as _
from filer.models import ThumbnailOption
from cms.admin.placeholderadmin import PlaceholderAdminMixin, FrontendEditableAdminMixin
from shop.admin.defaults import customer
from shop.admin.defaults.order import OrderAdmin
from shop.models.defaults.order import Order
from shop.admin.order import PrintInvoiceAdminMixin
from shop.admin.delivery import DeliveryOrderAdminMixin
from adminsortable2.admin import SortableAdminMixin, PolymorphicSortableAdminMixin
from shop.admin.product import CMSPageAsCategoryMixin, UnitPriceMixin, ProductImageInline, InvalidateProductCacheMixin, SearchProductIndexMixin, CMSPageFilter
from polymorphic.admin import (PolymorphicParentModelAdmin, PolymorphicChildModelAdmin,
PolymorphicChildModelFilter)
from weirdlittleempire.models import Product, Commodity, SmartPhoneVariant, SmartPhoneModel, OperatingSystem
from weirdlittleempire.models import Manufacturer, SmartCard
admin.site.site_header = "Weird Little Empire Administration"
admin.site.unregister(ThumbnailOption)
@admin.register(Order)
class OrderAdmin(PrintInvoiceAdminMixin, DeliveryOrderAdminMixin, OrderAdmin):
pass
admin.site.register(Manufacturer, admin.ModelAdmin)
__all__ = ['customer']
@admin.register(Commodity)
class CommodityAdmin(InvalidateProductCacheMixin, SearchProductIndexMixin, SortableAdminMixin, FrontendEditableAdminMixin,
PlaceholderAdminMixin, CMSPageAsCategoryMixin, PolymorphicChildModelAdmin):
"""
Since our Commodity model inherits from polymorphic Product, we have to redefine its admin class.
"""
base_model = Product
fields = [
('product_name', 'slug'),
('product_code', 'unit_price'),
'quantity',
'active',
'caption',
'manufacturer',
]
filter_horizontal = ['cms_pages']
inlines = [ProductImageInline]
prepopulated_fields = {'slug': ['product_name']}
@admin.register(SmartCard)
class SmartCardAdmin(InvalidateProductCacheMixin, SearchProductIndexMixin, SortableAdminMixin, FrontendEditableAdminMixin,
CMSPageAsCategoryMixin, PlaceholderAdminMixin, PolymorphicChildModelAdmin):
base_model = Product
fieldsets = (
(None, {
'fields': [
('product_name', 'slug'),
('product_code', 'unit_price'),
'quantity',
'active',
'caption',
'description',
],
}),
(_("Properties"), {
'fields': ['manufacturer', 'storage', 'card_type', 'speed'],
}),
)
filter_horizontal = ['cms_pages']
inlines = [ProductImageInline]
prepopulated_fields = {'slug': ['product_name']}
admin.site.register(OperatingSystem, admin.ModelAdmin)
class SmartPhoneInline(admin.TabularInline):
model = SmartPhoneVariant
extra = 0
@admin.register(SmartPhoneModel)
class SmartPhoneAdmin(InvalidateProductCacheMixin, SearchProductIndexMixin, SortableAdminMixin, FrontendEditableAdminMixin,
CMSPageAsCategoryMixin, PlaceholderAdminMixin, PolymorphicChildModelAdmin):
base_model = Product
fieldsets = [
(None, {
'fields': [
('product_name', 'slug'),
'active',
'caption',
'description',
],
}),
(_("Properties"), {
'fields': ['manufacturer', 'battery_type', 'battery_capacity', 'ram_storage',
'wifi_connectivity', 'bluetooth', 'gps', 'operating_system',
('width', 'height', 'weight',), 'screen_size'],
}),
]
filter_horizontal = ['cms_pages']
inlines = [ProductImageInline, SmartPhoneInline]
prepopulated_fields = {'slug': ['product_name']}
def render_text_index(self, instance):
template = get_template(
'search/indexes/weirdlittleempire/commodity_text.txt')
return template.render(Context({'object': instance}))
render_text_index.short_description = _("Text Index")
@admin.register(Product)
class ProductAdmin(PolymorphicSortableAdminMixin, PolymorphicParentModelAdmin):
base_model = Product
child_models = [SmartPhoneModel, SmartCard, Commodity]
list_display = ['product_name', 'get_price', 'product_type', 'active']
list_display_links = ['product_name']
search_fields = ['product_name']
list_filter = [PolymorphicChildModelFilter, CMSPageFilter]
list_per_page = 250
list_max_show_all = 1000
def get_price(self, obj):
return str(obj.get_real_instance().get_price(None))
get_price.short_description = _("Price starting at")

24
weirdlittleempire/apps.py Normal file
View File

@@ -0,0 +1,24 @@
import os
import logging
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
class WeirdLittleEmpire(AppConfig):
name = 'weirdlittleempire'
verbose_name = _("My Shop")
logger = logging.getLogger('weirdlittleempire')
def ready(self):
if not os.path.isdir(settings.STATIC_ROOT):
os.makedirs(settings.STATIC_ROOT)
if not os.path.isdir(settings.MEDIA_ROOT):
os.makedirs(settings.MEDIA_ROOT)
if hasattr(settings, 'COMPRESS_ROOT') and not os.path.isdir(settings.COMPRESS_ROOT):
os.makedirs(settings.COMPRESS_ROOT)
as_i18n = ""
self.logger.info("Running as polymorphic{}".format(as_i18n))
from weirdlittleempire import search_indexes
__all__ = ['search_indexes']

View File

@@ -0,0 +1,60 @@
from shop.cms_apphooks import CatalogSearchApp
from django.conf.urls import url
from rest_framework.settings import api_settings
from cms.apphook_pool import apphook_pool
from cms.cms_menus import SoftRootCutter
from menus.menu_pool import menu_pool
from shop.cms_apphooks import CatalogListCMSApp, CatalogSearchApp, OrderApp, PasswordResetApp
from shop.rest.filters import CMSPagesFilterBackend
class CatalogListApp(CatalogListCMSApp):
def get_urls(self, page=None, language=None, **kwargs):
from shop.search.mixins import ProductSearchViewMixin
from shop.views.catalog import AddToCartView, ProductListView, ProductRetrieveView
from shop.views.catalog import AddFilterContextMixin
from weirdlittleempire.filters import ManufacturerFilterSet
from weirdlittleempire.serializers import AddSmartPhoneToCartSerializer
ProductListView = type(
'ProductSearchListView', (AddFilterContextMixin, ProductSearchViewMixin, ProductListView), {})
filter_backends = [CMSPagesFilterBackend]
filter_backends.extend(api_settings.DEFAULT_FILTER_BACKENDS)
return [
url(r'^(?P<slug>[\w-]+)/add-to-cart', AddToCartView.as_view()),
url(r'^(?P<slug>[\w-]+)/add-smartphone-to-cart', AddToCartView.as_view(
serializer_class=AddSmartPhoneToCartSerializer,
)),
url(r'^(?P<slug>[\w-]+)', ProductRetrieveView.as_view(
use_modal_dialog=False,
)),
url(r'^', ProductListView.as_view(
filter_backends=filter_backends,
filter_class=ManufacturerFilterSet,
)),
]
apphook_pool.register(CatalogListApp)
apphook_pool.register(CatalogSearchApp)
apphook_pool.register(OrderApp)
apphook_pool.register(PasswordResetApp)
def _deregister_menu_pool_modifier(Modifier):
index = None
for k, modifier_class in enumerate(menu_pool.modifiers):
if issubclass(modifier_class, Modifier):
index = k
if index is not None:
# intentionally only modifying the list
menu_pool.modifiers.pop(index)
_deregister_menu_pool_modifier(SoftRootCutter)

View File

@@ -0,0 +1,3 @@
from django.utils.translation import ugettext_lazy as _
from cms.wizards.wizard_base import Wizard
from cms.wizards.wizard_pool import wizard_pool

View File

@@ -0,0 +1,39 @@
from django.forms.widgets import Select
from django.utils.translation import ugettext_lazy as _
from django_filters import FilterSet
from djng.forms import NgModelFormMixin
from djng.styling.bootstrap3.forms import Bootstrap3Form
from shop.filters import ModelChoiceFilter
from weirdlittleempire.models import Manufacturer, Product
class FilterForm(NgModelFormMixin, Bootstrap3Form):
scope_prefix = 'filters'
class ManufacturerFilterSet(FilterSet):
manufacturer = ModelChoiceFilter(
queryset=Manufacturer.objects.all(),
widget=Select(attrs={'ng-change': 'filterChanged()'}),
empty_label=_("Any Manufacturer"),
help_text=_("Restrict product on this manufacturer only"),
)
class Meta:
model = Product
form = FilterForm
fields = ['manufacturer']
@classmethod
def get_render_context(cls, request, queryset):
# create filter set with bound form, to enable the selected option
filter_set = cls(data=request.GET)
# we only want to show manufacturers for products available in the current list view
filter_field = filter_set.filters['manufacturer'].field
filter_field.queryset = filter_field.queryset.filter(
id__in=queryset.values_list('manufacturer_id'))
return dict(filter_set=filter_set)

View File

@@ -0,0 +1,43 @@
import os
from django.conf import settings
from django.contrib.staticfiles.finders import (FileSystemFinder as FileSystemFinderBase,
AppDirectoriesFinder as AppDirectoriesFinderBase)
class FileSystemFinder(FileSystemFinderBase):
"""
In debug mode, serve /static/any/asset.min.ext as /static/any/asset.ext
"""
locations = []
serve_unminimized = getattr(settings, 'DEBUG', False)
def find_location(self, root, path, prefix=None):
if self.serve_unminimized:
# search for the unminimized version, and if it exists, return it
base, ext = os.path.splitext(path)
base, minext = os.path.splitext(base)
if minext == '.min':
unminimized_path = super().find_location(root, base + ext, prefix)
if unminimized_path:
return unminimized_path
# otherwise proceed with the given one
path = super().find_location(root, path, prefix)
return path
class AppDirectoriesFinder(AppDirectoriesFinderBase):
serve_unminimized = getattr(settings, 'DEBUG', False)
def find_in_app(self, app, path):
matched_path = super().find_in_app(app, path)
if matched_path and self.serve_unminimized:
base, ext = os.path.splitext(matched_path)
base, minext = os.path.splitext(base)
if minext == '.min':
storage = self.storages.get(app, None)
path = '{}{}'.format(base, ext)
if storage.exists(path):
path = storage.path(path)
if path:
return path
return matched_path

View File

@@ -0,0 +1,5 @@
from shop.forms.checkout import CustomerForm as CustomerFormBase
class CustomerForm(CustomerFormBase):
field_order = ['salutation', 'first_name', 'last_name', 'email']

View File

View File

@@ -0,0 +1,37 @@
from django.core.management.base import BaseCommand
from cmsplugin_cascade.icon.utils import zipfile, unzip_archive
class Command(BaseCommand):
help = "Iterates over all files in Filer and creates an IconFont for all eligibles."
def handle(self, verbosity, *args, **options):
self.verbosity = verbosity
self.assign_files_to_iconfonts()
def assign_files_to_iconfonts(self):
from filer.models.filemodels import File
from cmsplugin_cascade.models import IconFont
for file in File.objects.all():
if file.label != 'Font Awesome':
continue
if self.verbosity >= 2:
self.stdout.write(
"Creating Icon Font from: {}".format(file.label))
try:
zip_ref = zipfile.ZipFile(file.file, 'r')
except zipfile.BadZipFile as exc:
self.stderr.write(
"Unable to unpack {}: {}".format(file.label, exc))
else:
if not IconFont.objects.filter(zip_file=file).exists():
font_folder, config_data = unzip_archive(
file.label, zip_ref)
IconFont.objects.create(
identifier=config_data['name'],
config_data=config_data,
zip_file=file,
font_folder=font_folder,
)
zip_ref.close()

View File

@@ -0,0 +1,41 @@
from cms.models.static_placeholder import StaticPlaceholder
from django.core.management.base import BaseCommand
from cmsplugin_cascade.models import CascadeClipboard
from shop.management.utils import deserialize_to_placeholder
class Command(BaseCommand):
help = "Iterates over all files in Filer and creates an IconFont for all eligibles."
def handle(self, verbosity, *args, **options):
self.verbosity = verbosity
self.create_social_icons()
def create_social_icons(self):
from cms.utils.i18n import get_public_languages
default_language = get_public_languages()[0]
try:
clipboard = CascadeClipboard.objects.get(identifier='social-icons')
except CascadeClipboard.DoesNotExist:
self.stderr.write(
"No Persisted Clipboard named 'social-icons' found.")
else:
static_placeholder = StaticPlaceholder.objects.create(
code='Social Icons')
deserialize_to_placeholder(
static_placeholder.public, clipboard.data, default_language)
deserialize_to_placeholder(
static_placeholder.draft, clipboard.data, default_language)
self.stdout.write("Added Social Icons to Static Placeholder")
def publish_in_all_languages(self, page):
from cms.api import copy_plugins_to_language
from cms.utils.i18n import get_public_languages
languages = get_public_languages()
for language in languages[1:]:
copy_plugins_to_language(page, languages[0], language)
for language in languages:
page.publish(language)

View File

@@ -0,0 +1,64 @@
import os
import requests
from io import BytesIO as StringIO
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
try:
import czipfile as zipfile
except ImportError:
import zipfile
from .spinner import Spinner
class Command(BaseCommand):
version = 18
help = "Download workdir to run a demo of django-SHOP."
download_url = 'https://downloads.django-shop.org/django-shop-workdir-{version}.zip'
def add_arguments(self, parser):
parser.add_argument(
'--noinput',
'--no-input',
action='store_false',
dest='interactive',
default=True,
help="Do NOT prompt the user for input of any kind.",
)
def set_options(self, **options):
self.interactive = options['interactive']
def handle(self, verbosity, *args, **options):
self.set_options(**options)
fixture1 = '{workdir}/fixtures/products-media.json'.format(
workdir=settings.WORK_DIR)
fixture2 = '{workdir}/fixtures/products-meta.json'.format(
workdir=settings.WORK_DIR)
if os.path.isfile(fixture1) or os.path.isfile(fixture2):
if self.interactive:
mesg = """
This will overwrite your workdir for your django-SHOP demo.
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel:
"""
if input(mesg) != 'yes':
raise CommandError(
"Downloading workdir has been cancelled.")
else:
self.stdout.write(self.style.WARNING(
"Can not override downloaded data in input-less mode."))
return
extract_to = os.path.join(settings.WORK_DIR, os.pardir)
msg = "Downloading workdir and extracting to {}. Please wait"
self.stdout.write(msg.format(extract_to), ending=' ')
with Spinner():
download_url = self.download_url.format(version=self.version)
response = requests.get(download_url, stream=True)
zip_ref = zipfile.ZipFile(StringIO(response.content))
try:
zip_ref.extractall(extract_to)
finally:
zip_ref.close()
self.stdout.write('- done.')

View File

@@ -0,0 +1,35 @@
import json
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
from django.utils.module_loading import import_string
from django.utils.translation import activate
from weirdlittleempire.models import Product
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'-o',
'--output',
type=str,
dest='filename',
)
def handle(self, verbosity, filename, *args, **options):
activate(settings.LANGUAGE_CODE)
data = []
for product in Product.objects.all():
ProductModel = ContentType.objects.get(
app_label='weirdlittleempire', model=product.product_model)
class_name = 'weirdlittleempire.management.serializers.' + \
ProductModel.model_class().__name__ + 'Serializer'
serializer_class = import_string(class_name)
serializer = serializer_class(product, context={'request': None})
data.append(serializer.data)
dump = json.dumps(data, indent=2)
if filename:
with open(filename, 'w') as fh:
fh.write(dump)
else:
self.stdout.write(dump)

View File

@@ -0,0 +1,84 @@
import json
import os
from cms.utils.copy_plugins import copy_plugins_to
from cms.utils.i18n import get_public_languages
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand, CommandError
from django.utils.module_loading import import_string
from django.utils.translation import activate
from cmsplugin_cascade.models import CascadeClipboard
from shop.management.utils import deserialize_to_placeholder
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'filename',
nargs='?',
default='products-meta.json',
)
def handle(self, verbosity, filename, *args, **options):
activate(settings.LANGUAGE_CODE)
path = self.find_fixture(filename)
if verbosity >= 2:
self.stdout.write("Importing products from: {}".format(path))
with open(path, 'r') as fh:
data = json.load(fh)
for number, product in enumerate(data, 1):
product_model = product.pop('product_model')
if product.get('product_code') == "parklake-springfield":
continue
ProductModel = ContentType.objects.get(
app_label='weirdlittleempire', model=product_model)
class_name = 'weirdlittleempire.management.serializers.' + \
ProductModel.model_class().__name__ + 'Serializer'
serializer_class = import_string(class_name)
serializer = serializer_class(data=product)
assert serializer.is_valid(), serializer.errors
instance = serializer.save()
self.assign_product_to_catalog(instance)
self.stdout.write("{}. {}".format(number, instance))
if product_model == 'commodity':
languages = get_public_languages()
try:
clipboard = CascadeClipboard.objects.get(
identifier=instance.slug)
except CascadeClipboard.DoesNotExist:
pass
else:
deserialize_to_placeholder(
instance.placeholder, clipboard.data, languages[0])
plugins = list(instance.placeholder.get_plugins(
language=languages[0]).order_by('path'))
for language in languages[1:]:
copy_plugins_to(
plugins, instance.placeholder, language)
def find_fixture(self, filename):
if os.path.isabs(filename):
fixture_dirs = [os.path.dirname(filename)]
fixture_name = os.path.basename(filename)
else:
fixture_dirs = settings.FIXTURE_DIRS
if os.path.sep in os.path.normpath(filename):
fixture_dirs = [os.path.join(dir_, os.path.dirname(filename))
for dir_ in fixture_dirs]
fixture_name = os.path.basename(filename)
else:
fixture_name = filename
for fixture_dir in fixture_dirs:
path = os.path.join(fixture_dir, fixture_name)
if os.path.exists(path):
return path
raise CommandError(
"No such file in any fixture dir: {}".format(filename))
def assign_product_to_catalog(self, product):
from cms.models.pagemodel import Page
from shop.models.related import ProductPageModel
for page in Page.objects.published().filter(application_urls='CatalogListApp'):
ProductPageModel.objects.get_or_create(page=page, product=product)

View File

@@ -0,0 +1,26 @@
import random
from django.core.management.base import BaseCommand
from weirdlittleempire.models import Commodity, CommodityInventory, SmartCard, SmartCardInventory, SmartPhoneVariant, SmartPhoneInventory
class Command(BaseCommand):
help = "Create Inventories for all products using random values."
def handle(self, verbosity, *args, **options):
self.verbosity = verbosity
for commodity in Commodity.objects.all():
CommodityInventory.objects.create(
product=commodity,
quantity=random.randint(0, 15)
)
for smart_card in SmartCard.objects.all():
SmartCardInventory.objects.create(
product=smart_card,
quantity=random.randint(0, 55)
)
for smart_phone in SmartPhoneVariant.objects.all():
SmartPhoneInventory.objects.create(
product=smart_phone,
quantity=random.randint(0, 8)
)
self.stdout.write("Created inventories with random quantities.")

View File

@@ -0,0 +1,104 @@
import os
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.utils.translation import ugettext_lazy as _
try:
import czipfile as zipfile
except ImportError:
import zipfile
class Command(BaseCommand):
help = _("Initialize the workdir to run the demo of weirdlittleempire.")
def add_arguments(self, parser):
parser.add_argument(
'--noinput', '--no-input',
action='store_false',
dest='interactive',
default=True,
help="Do NOT prompt the user for input of any kind.",
)
def set_options(self, **options):
self.interactive = options['interactive']
def clear_compressor_cache(self):
from django.core.cache import caches
from django.core.cache.backends.base import InvalidCacheBackendError
from compressor.conf import settings
cache_dir = os.path.join(settings.STATIC_ROOT,
settings.COMPRESS_OUTPUT_DIR)
if settings.COMPRESS_ENABLED is False or not os.path.isdir(cache_dir) or os.listdir(cache_dir) != []:
return
try:
caches['compressor'].clear()
except InvalidCacheBackendError:
pass
def handle(self, verbosity, *args, **options):
self.set_options(**options)
self.clear_compressor_cache()
call_command('migrate')
initialize_file = os.path.join(settings.WORK_DIR, '.initialize')
if os.path.isfile(initialize_file):
self.stdout.write("Initializing project weirdlittleempire")
call_command('makemigrations', 'weirdlittleempire')
call_command('migrate')
os.remove(initialize_file)
call_command('loaddata', 'skeleton')
call_command('shop', 'check-pages', add_recommended=True)
call_command('assign_iconfonts')
call_command('create_social_icons')
call_command('download_workdir', interactive=self.interactive)
call_command('loaddata', 'products-media')
call_command('import_products')
self.create_polymorphic_subcategories()
try:
call_command('search_index', action='rebuild', force=True)
except:
pass
else:
self.stdout.write("Project weirdlittleempire already initialized")
call_command('migrate')
def create_polymorphic_subcategories(self):
from cms.models.pagemodel import Page
from shop.management.commands.shop import Command as ShopCommand
from weirdlittleempire.models import Commodity, SmartCard, SmartPhoneModel
apphook = ShopCommand.get_installed_apphook('CatalogListCMSApp')
catalog_pages = Page.objects.drafts().filter(
application_urls=apphook.__class__.__name__)
assert catalog_pages.count() == 1, "There should be only one catalog page"
self.create_subcategory(
apphook, catalog_pages.first(), "Earphones", Commodity)
self.create_subcategory(
apphook, catalog_pages.first(), "Smart Cards", SmartCard)
self.create_subcategory(
apphook, catalog_pages.first(), "Smart Phones", SmartPhoneModel)
def create_subcategory(self, apphook, parent_page, title, product_type):
from cms.api import create_page
from cms.constants import TEMPLATE_INHERITANCE_MAGIC
from cms.utils.i18n import get_public_languages
from shop.management.commands.shop import Command as ShopCommand
from shop.models.product import ProductModel
from shop.models.related import ProductPageModel
language = get_public_languages()[0]
page = create_page(
title,
TEMPLATE_INHERITANCE_MAGIC,
language,
apphook=apphook,
created_by="manage.py initialize_shop_demo",
in_navigation=True,
parent=parent_page,
)
ShopCommand.publish_in_all_languages(page)
page = page.get_public_object()
for product in ProductModel.objects.instance_of(product_type):
ProductPageModel.objects.create(page=page, product=product)

View File

@@ -0,0 +1,37 @@
import sys
import time
import threading
class Spinner:
busy = False
delay = 0.1
@staticmethod
def spinning_cursor():
while 1:
for cursor in '|/-\\':
yield cursor
def __init__(self, delay=None):
self.spinner_generator = self.spinning_cursor()
if delay and float(delay):
self.delay = delay
def spinner_task(self):
while self.busy:
sys.stdout.write(next(self.spinner_generator))
sys.stdout.flush()
time.sleep(self.delay)
sys.stdout.write('\b')
sys.stdout.flush()
def __enter__(self):
self.busy = True
threading.Thread(target=self.spinner_task).start()
def __exit__(self, exception, value, tb):
self.busy = False
time.sleep(self.delay)
if exception is not None:
return False

View File

@@ -0,0 +1,68 @@
"""
These serializers are used exclusively to import the file ``workdir/fixtures/products-meta.json``.
They are not intended for general purpose and can be deleted thereafter.
"""
from rest_framework import serializers
from shop.serializers.catalog import CMSPagesField, ImagesField, ValueRelatedField
from weirdlittleempire.models import (Commodity, SmartCard, SmartPhoneModel, SmartPhoneVariant,
Manufacturer, OperatingSystem, ProductPage, ProductImage)
from .translation import TranslatedFieldsField, TranslatedField, TranslatableModelSerializerMixin
class ProductSerializer(serializers.ModelSerializer):
product_model = serializers.CharField(read_only=True)
manufacturer = ValueRelatedField(model=Manufacturer)
images = ImagesField()
caption = TranslatedField()
cms_pages = CMSPagesField()
class Meta:
exclude = ['id', 'polymorphic_ctype', 'updated_at']
def create(self, validated_data):
cms_pages = validated_data.pop('cms_pages')
images = validated_data.pop('images')
product = super().create(validated_data)
for page in cms_pages:
ProductPage.objects.create(product=product, page=page)
for image in images:
ProductImage.objects.create(product=product, image=image)
return product
class CommoditySerializer(TranslatableModelSerializerMixin, ProductSerializer):
class Meta(ProductSerializer.Meta):
model = Commodity
exclude = ['id', 'placeholder', 'polymorphic_ctype', 'updated_at']
class SmartCardSerializer(TranslatableModelSerializerMixin, ProductSerializer):
multilingual = TranslatedFieldsField(
help_text="Helper to convert multilingual data into single field.",
)
class Meta(ProductSerializer.Meta):
model = SmartCard
class SmartphoneVariantSerializer(serializers.ModelSerializer):
class Meta:
model = SmartPhoneVariant
fields = ['product_code', 'unit_price', 'storage', 'quantity']
class SmartPhoneModelSerializer(TranslatableModelSerializerMixin, ProductSerializer):
multilingual = TranslatedFieldsField()
operating_system = ValueRelatedField(model=OperatingSystem)
variants = SmartphoneVariantSerializer(many=True)
class Meta(ProductSerializer.Meta):
model = SmartPhoneModel
def create(self, validated_data):
variants = validated_data.pop('variants')
product = super().create(validated_data)
for variant in variants:
SmartPhoneVariant.objects.create(product=product, **variant)
return product

View File

@@ -0,0 +1,73 @@
"""
These serializer mixinins and fields are used exclusively to import the file
``workdir/fixtures/products-meta.json``. They are not intended for general
purpose and can be deleted thereafter.
"""
from rest_framework import serializers
class TranslatableModelSerializerMixin:
"""
Pseudo class mimicking the behaviour of :class:`parler_rest.TranslatableModelSerializerMixin`.
It converts the content for fields of type TranslatedFieldsField to simple serializer
fields.
"""
def to_internal_value(self, data):
data = self._unify_translated_data(data)
result = super().to_internal_value(data)
return result
def _unify_translated_data(self, data):
"""
Unify translated data to be used by simple serializer fields.
"""
for field_name, field in self.get_fields().items():
if isinstance(field, TranslatedFieldsField):
key = field.source or field_name
translations = data.pop(key, None)
if isinstance(translations, dict):
data.update(translations.get('en', {}))
return data
class TranslatedFieldsField(serializers.Field):
"""
Pseudo class mimicking the behaviour of :class:`parler_rest.TranslatedFieldsField`, where only
the English translation is used.
"""
def to_representation(self, value):
raise NotImplementedError(
"If USE_I18N is False, do not use {cls}.to_representation() for field '{field_name}'. "
"It thwarts the possibility to reuse that string in a multi language environment.".format(
cls=self.__class__.__name__,
field_name=self.field_name,
)
)
def validate_empty_values(self, data):
raise serializers.SkipField()
class TranslatedField(serializers.Field):
"""
Pseudo class mimicking the behaviour of :class:`parler_rest.TranslatedField`, where only
the English translation is used.
"""
def to_representation(self, value):
raise NotImplementedError(
"If USE_I18N is False, do not use {cls}.to_representation() for field '{field_name}'. "
"It thwarts the possibility to reuse that string in a multi language environment.".format(
cls=self.__class__.__name__,
field_name=self.field_name,
)
)
def to_internal_value(self, data):
return data.get('en')
__all__ = ['TranslatedFieldsField', 'TranslatedField',
'TranslatableModelSerializerMixin']

View File

405
weirdlittleempire/models.py Normal file
View File

@@ -0,0 +1,405 @@
from decimal import Decimal
from django.core.exceptions import ObjectDoesNotExist
from django.core.validators import MinValueValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _
from djangocms_text_ckeditor.fields import HTMLField
from cms.models.fields import PlaceholderField
from shop.money import Money, MoneyMaker
from shop.money.fields import MoneyField
from shop.models.product import BaseProduct, BaseProductManager, AvailableProductMixin, CMSPageReferenceMixin
from shop.models.defaults.cart import Cart
from shop.models.defaults.cart_item import CartItem
from shop.models.order import BaseOrderItem
from shop.models.defaults.delivery import Delivery
from shop.models.defaults.delivery_item import DeliveryItem
from shop.models.defaults.order import Order
from shop.models.defaults.mapping import ProductPage, ProductImage
from shop.models.defaults.address import BillingAddress, ShippingAddress
from shop.models.defaults.customer import Customer
__all__ = ['Cart', 'CartItem', 'Order', 'Delivery', 'DeliveryItem',
'BillingAddress', 'ShippingAddress', 'Customer', ]
class OrderItem(BaseOrderItem):
quantity = models.PositiveIntegerField(_("Ordered quantity"))
canceled = models.BooleanField(_("Item canceled "), default=False)
def populate_from_cart_item(self, cart_item, request):
super().populate_from_cart_item(cart_item, request)
# the product's unit_price must be fetched from the product's variant
try:
variant = cart_item.product.get_product_variant(
product_code=cart_item.product_code)
self._unit_price = Decimal(variant.unit_price)
except (KeyError, ObjectDoesNotExist) as e:
raise CartItem.DoesNotExist(e)
class Manufacturer(models.Model):
name = models.CharField(
_("Name"),
max_length=50,
unique=True,
)
def __str__(self):
return self.name
class ProductManager(BaseProductManager):
pass
class Product(CMSPageReferenceMixin, BaseProduct):
"""
Base class to describe a polymorphic product. Here we declare common fields available in all of
our different product types. These common fields are also used to build up the view displaying
a list of all products.
"""
product_name = models.CharField(
_("Product Name"),
max_length=255,
)
slug = models.SlugField(
_("Slug"),
unique=True,
)
caption = HTMLField(
verbose_name=_("Caption"),
blank=True,
null=True,
configuration='CKEDITOR_SETTINGS_CAPTION',
help_text=_(
"Short description used in the catalog's list view of products."),
)
# common product properties
manufacturer = models.ForeignKey(
Manufacturer,
on_delete=models.CASCADE,
verbose_name=_("Manufacturer"),
)
# controlling the catalog
order = models.PositiveIntegerField(
_("Sort by"),
db_index=True,
)
cms_pages = models.ManyToManyField(
'cms.Page',
through=ProductPage,
help_text=_("Choose list view this product shall appear on."),
)
images = models.ManyToManyField(
'filer.Image',
through=ProductImage,
)
class Meta:
ordering = ('order',)
verbose_name = _("Product")
verbose_name_plural = _("Products")
objects = ProductManager()
# filter expression used to lookup for a product item using the Select2 widget
lookup_fields = ['product_name__icontains']
def __str__(self):
return self.product_name
@property
def sample_image(self):
return self.images.first()
class Commodity(AvailableProductMixin, Product):
"""
This Commodity model inherits from polymorphic Product, and therefore has to be redefined.
"""
unit_price = MoneyField(
_("Unit price"),
decimal_places=3,
help_text=_("Net price for this product"),
)
product_code = models.CharField(
_("Product code"),
max_length=255,
unique=True,
)
quantity = models.PositiveIntegerField(
_("Quantity"),
default=0,
validators=[MinValueValidator(0)],
help_text=_("Available quantity in stock")
)
# controlling the catalog
placeholder = PlaceholderField("Commodity Details")
show_breadcrumb = True # hard coded to always show the product's breadcrumb
class Meta:
verbose_name = _("Commodity")
verbose_name_plural = _("Commodities")
default_manager = ProductManager()
def get_price(self, request):
return self.unit_price
class SmartCard(AvailableProductMixin, Product):
unit_price = MoneyField(
_("Unit price"),
decimal_places=3,
help_text=_("Net price for this product"),
)
card_type = models.CharField(
_("Card Type"),
choices=[2 * ('{}{}'.format(s, t),)
for t in ['SD', 'SDXC', 'SDHC', 'SDHC II'] for s in ['', 'micro ']],
max_length=15,
)
speed = models.CharField(
_("Transfer Speed"),
choices=[(str(s), "{} MB/s".format(s))
for s in [4, 20, 30, 40, 48, 80, 95, 280]],
max_length=8,
)
product_code = models.CharField(
_("Product code"),
max_length=255,
unique=True,
)
storage = models.PositiveIntegerField(
_("Storage Capacity"),
help_text=_("Storage capacity in GB"),
)
description = HTMLField(
_("Description"),
configuration='CKEDITOR_SETTINGS_DESCRIPTION',
help_text=_("Long description for the detail view of this product."),
)
quantity = models.PositiveIntegerField(
_("Quantity"),
default=0,
validators=[MinValueValidator(0)],
help_text=_("Available quantity in stock")
)
class Meta:
verbose_name = _("Smart Card")
verbose_name_plural = _("Smart Cards")
ordering = ['order']
# filter expression used to lookup for a product item using the Select2 widget
lookup_fields = ['product_code__startswith', 'product_name__icontains']
def get_price(self, request):
return self.unit_price
default_manager = ProductManager()
class OperatingSystem(models.Model):
name = models.CharField(
_("Name"),
max_length=50,
unique=True,
)
def __str__(self):
return self.name
class SmartPhoneModel(Product):
"""
A generic smart phone model, which must be concretized by a `SmartPhoneVariant` - see below.
"""
BATTERY_TYPES = [
(1, "Lithium Polymer (Li-Poly)"),
(2, "Lithium Ion (Li-Ion)"),
]
WIFI_CONNECTIVITY = [
(1, "802.11 b/g/n"),
]
BLUETOOTH_CONNECTIVITY = [
(1, "Bluetooth 4.0"),
(2, "Bluetooth 3.0"),
(3, "Bluetooth 2.1"),
]
battery_type = models.PositiveSmallIntegerField(
_("Battery type"),
choices=BATTERY_TYPES,
)
battery_capacity = models.PositiveIntegerField(
_("Capacity"),
help_text=_("Battery capacity in mAh"),
)
ram_storage = models.PositiveIntegerField(
_("RAM"),
help_text=_("RAM storage in MB"),
)
wifi_connectivity = models.PositiveIntegerField(
_("WiFi"),
choices=WIFI_CONNECTIVITY,
help_text=_("WiFi Connectivity"),
)
bluetooth = models.PositiveIntegerField(
_("Bluetooth"),
choices=BLUETOOTH_CONNECTIVITY,
help_text=_("Bluetooth Connectivity"),
)
gps = models.BooleanField(
_("GPS"),
default=False,
help_text=_("GPS integrated"),
)
operating_system = models.ForeignKey(
OperatingSystem,
on_delete=models.CASCADE,
verbose_name=_("Operating System"),
)
width = models.DecimalField(
_("Width"),
max_digits=4,
decimal_places=1,
help_text=_("Width in mm"),
)
height = models.DecimalField(
_("Height"),
max_digits=4,
decimal_places=1,
help_text=_("Height in mm"),
)
weight = models.DecimalField(
_("Weight"),
max_digits=5,
decimal_places=1,
help_text=_("Weight in gram"),
)
screen_size = models.DecimalField(
_("Screen size"),
max_digits=4,
decimal_places=2,
help_text=_("Diagonal screen size in inch"),
)
description = HTMLField(
verbose_name=_("Description"),
configuration='CKEDITOR_SETTINGS_DESCRIPTION',
help_text=_(
"Full description used in the catalog's detail view of Smart Phones."),
)
class Meta:
verbose_name = _("Smart Phone")
verbose_name_plural = _("Smart Phones")
default_manager = ProductManager()
def get_price(self, request):
"""
Return the starting price for instances of this smart phone model.
"""
if not hasattr(self, '_price'):
if self.variants.exists():
currency = self.variants.first().unit_price.currency
aggr = self.variants.aggregate(models.Min('unit_price'))
self._price = MoneyMaker(currency)(aggr['unit_price__min'])
else:
self._price = Money()
return self._price
def get_availability(self, request, **kwargs):
variant = self.get_product_variant(**kwargs)
return variant.get_availability(request)
def deduct_from_stock(self, quantity, **kwargs):
variant = self.get_product_variant(**kwargs)
variant.deduct_from_stock(quantity)
def is_in_cart(self, cart, watched=False, **kwargs):
try:
product_code = kwargs['product_code']
except KeyError:
return
cart_item_qs = CartItem.objects.filter(cart=cart, product=self)
for cart_item in cart_item_qs:
if cart_item.product_code == product_code:
return cart_item
def get_product_variant(self, **kwargs):
try:
product_code = kwargs.get('product_code')
return self.variants.get(product_code=product_code)
except SmartPhoneVariant.DoesNotExist as e:
raise SmartPhoneModel.DoesNotExist(e)
def get_product_variants(self):
return self.variants.all()
class SmartPhoneVariant(AvailableProductMixin, models.Model):
product = models.ForeignKey(
SmartPhoneModel,
on_delete=models.CASCADE,
verbose_name=_("Smartphone Model"),
related_name='variants',
)
product_code = models.CharField(
_("Product code"),
max_length=255,
unique=True,
)
unit_price = MoneyField(
_("Unit price"),
decimal_places=3,
help_text=_("Net price for this product"),
)
storage = models.PositiveIntegerField(
_("Internal Storage"),
help_text=_("Internal storage in GB"),
)
quantity = models.PositiveIntegerField(
_("Quantity"),
default=0,
validators=[MinValueValidator(0)],
help_text=_("Available quantity in stock")
)
def __str__(self):
return _("{product} with {storage} GB").format(product=self.product, storage=self.storage)
def get_price(self, request):
return self.unit_price

View File

@@ -0,0 +1,52 @@
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from shop.modifiers.pool import cart_modifiers_pool
from shop.modifiers.defaults import DefaultCartModifier
from shop.serializers.cart import ExtraCartRow
from shop.money import Money
from shop.shipping.modifiers import ShippingModifier
from shop_stripe import modifiers
class PrimaryCartModifier(DefaultCartModifier):
"""
Extended default cart modifier which handles the price for product variations
"""
def process_cart_item(self, cart_item, request):
variant = cart_item.product.get_product_variant(
product_code=cart_item.product_code)
cart_item.unit_price = variant.unit_price
cart_item.line_total = cart_item.unit_price * cart_item.quantity
# grandparent super
return super(DefaultCartModifier, self).process_cart_item(cart_item, request)
class PostalShippingModifier(ShippingModifier):
"""
This is just a demo on how to implement a shipping modifier, which when selected
by the customer, adds an additional charge to the cart.
"""
identifier = 'postal-shipping'
def get_choice(self):
return (self.identifier, _("Postal shipping"))
def add_extra_cart_row(self, cart, request):
shipping_modifiers = cart_modifiers_pool.get_shipping_modifiers()
if not self.is_active(cart.extra.get('shipping_modifier')) and len(shipping_modifiers) > 1:
return
# add a shipping flat fee
amount = Money('5')
instance = {'label': _("Shipping costs"), 'amount': amount}
cart.extra_rows[self.identifier] = ExtraCartRow(instance)
cart.total += amount
def ship_the_goods(self, delivery):
if not delivery.shipping_id:
raise ValidationError("Please provide a valid Shipping ID")
super().ship_the_goods(delivery)
class StripePaymentModifier(modifiers.StripePaymentModifier):
commision_percentage = 3

View File

@@ -0,0 +1,8 @@
from shop.search.documents import ProductDocument
settings = {
'number_of_shards': 1,
'number_of_replicas': 0,
}
ProductDocument(settings=settings)

View File

@@ -0,0 +1,31 @@
from shop.models.cart import CartModel
from shop.serializers.defaults.catalog import AddToCartSerializer
class AddSmartPhoneToCartSerializer(AddToCartSerializer):
"""
Modified AddToCartSerializer which handles SmartPhones
"""
def get_instance(self, context, data, extra_args):
product = context['product']
request = context['request']
try:
cart = CartModel.objects.get_from_request(request)
except CartModel.DoesNotExist:
cart = None
try:
variant = product.get_product_variant(
product_code=data['product_code'])
except (TypeError, KeyError, product.DoesNotExist):
variant = product.variants.first()
instance = {
'product': product.id,
'product_code': variant.product_code,
'unit_price': variant.unit_price,
'is_in_cart': bool(product.is_in_cart(cart, product_code=variant.product_code)),
'extra': {'storage': variant.storage},
'availability': variant.get_availability(request),
}
return instance

View File

@@ -0,0 +1,598 @@
"""
Django settings for weirdlittleempire project.
For more information on this file, see
https://docs.djangoproject.com/en/stable/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/stable/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
from decimal import Decimal
import os
from django.urls import reverse_lazy
from django.utils.text import format_lazy
from django.utils.translation import ugettext_lazy as _
from cmsplugin_cascade.bootstrap4.mixins import BootstrapUtilities
from cmsplugin_cascade.extra_fields.config import PluginExtraFieldsConfig
SHOP_APP_LABEL = 'weirdlittleempire'
BASE_DIR = os.path.dirname(__file__)
# Root directory for this django project
PROJECT_ROOT = os.path.abspath(os.path.join(BASE_DIR, os.path.pardir))
# Directory where working files, such as media and databases are kept
WORK_DIR = os.environ.get('DJANGO_WORKDIR', os.path.abspath(
os.path.join(PROJECT_ROOT, 'workdir')))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
ADMINS = [("A Jones", 'biz@aronajones.com')]
# SECURITY WARNING: in production, inject the secret key through the environment
SECRET_KEY = os.environ.get(
'DJANGO_SECRET_KEY', 'Q1ayyKMNv4figvm1DDseLjWlOHn4OI7lW2hxNn0BztgWkXJLBTFDkYJCmY2OshPt')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
SITE_ID = 1
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'GMT'
USE_THOUSAND_SEPARATOR = True
# Application definition
# replace django.contrib.auth.models.User by implementation
# allowing to login via email address
AUTH_USER_MODEL = 'email_auth.User'
AUTH_PASSWORD_VALIDATORS = [{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
'OPTIONS': {
'min_length': 6,
}
}]
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
]
INSTALLED_APPS = [
'django.contrib.auth',
'email_auth',
'polymorphic',
# deprecated: 'djangocms_admin_style',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sitemaps',
'djangocms_text_ckeditor',
'django_select2',
'cmsplugin_cascade',
'cmsplugin_cascade.clipboard',
'cmsplugin_cascade.sharable',
'cmsplugin_cascade.extra_fields',
'cmsplugin_cascade.icon',
'cmsplugin_cascade.segmentation',
'cms_bootstrap',
'adminsortable2',
'rest_framework',
'rest_framework.authtoken',
'rest_auth',
'django_elasticsearch_dsl',
'django_fsm',
'fsm_admin',
'djng',
'cms',
'menus',
'treebeard',
'compressor',
'sass_processor',
'sekizai',
'django_filters',
'filer',
'easy_thumbnails',
'easy_thumbnails.optimize',
'post_office',
'shop_stripe',
'shop',
'weirdlittleempire',
]
MIDDLEWARE = [
# 'django.middleware.cache.UpdateCacheMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'shop.middleware.CustomerMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.gzip.GZipMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.utils.ApphookReloadMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
# 'django.middleware.cache.FetchFromCacheMiddleware',
]
ROOT_URLCONF = 'weirdlittleempire.urls'
WSGI_APPLICATION = 'wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(WORK_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/stable/topics/i18n/
LANGUAGE_CODE = 'en'
USE_I18N = False
USE_L10N = True
USE_TZ = True
USE_X_FORWARDED_HOST = True
X_FRAME_OPTIONS = 'SAMEORIGIN'
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.join(WORK_DIR, 'media')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = '/media/'
# Absolute path to the directory that holds static files.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.getenv('DJANGO_STATIC_ROOT', os.path.join(WORK_DIR, 'static'))
# URL that handles the static files served from STATIC_ROOT.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
STATICFILES_FINDERS = [
# or 'django.contrib.staticfiles.finders.FileSystemFinder',
'weirdlittleempire.finders.FileSystemFinder',
# or 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'weirdlittleempire.finders.AppDirectoriesFinder',
'sass_processor.finders.CssFinder',
'compressor.finders.CompressorFinder',
]
STATICFILES_DIRS = [
('node_modules', os.path.join(PROJECT_ROOT, 'node_modules')),
]
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS': [],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.template.context_processors.csrf',
'django.template.context_processors.request',
'django.contrib.messages.context_processors.messages',
'sekizai.context_processors.sekizai',
'cms.context_processors.cms_settings',
'shop.context_processors.customer',
'shop.context_processors.shop_settings',
'shop_stripe.context_processors.public_keys',
]
}
}, {
'BACKEND': 'post_office.template.backends.post_office.PostOfficeTemplates',
'APP_DIRS': True,
'DIRS': [],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.template.context_processors.request',
]
}
}]
POST_OFFICE = {
'TEMPLATE_ENGINE': 'post_office',
}
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
},
'select2': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
############################################
# settings for caching and storing session data
REDIS_HOST = os.getenv('REDIS_HOST')
if REDIS_HOST:
SESSION_ENGINE = 'redis_sessions.session'
SESSION_REDIS = {
'host': REDIS_HOST,
'port': 6379,
'db': 0,
'prefix': 'session-',
'socket_timeout': 1
}
CACHES['default'] = {
'BACKEND': 'redis_cache.RedisCache',
'LOCATION': 'redis://{}:6379/1'.format(REDIS_HOST),
}
COMPRESS_CACHE_BACKEND = 'compressor'
CACHES[COMPRESS_CACHE_BACKEND] = {
'BACKEND': 'redis_cache.RedisCache',
'LOCATION': 'redis://{}:6379/2'.format(REDIS_HOST),
}
CACHE_MIDDLEWARE_ALIAS = 'default'
CACHE_MIDDLEWARE_SECONDS = 3600
else:
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
SESSION_SAVE_EVERY_REQUEST = True
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}},
'formatters': {
'simple': {
'format': '[%(asctime)s %(module)s] %(levelname)s: %(message)s'
},
},
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'simple',
},
},
'loggers': {
'django': {
'handlers': ['console'],
'level': 'INFO',
'propagate': True,
},
'post_office': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': True,
},
},
}
SILENCED_SYSTEM_CHECKS = ['auth.W004']
FIXTURE_DIRS = [
os.path.join(WORK_DIR, 'fixtures'),
]
############################################
# settings for sending mail
EMAIL_HOST = os.getenv('DJANGO_EMAIL_HOST', 'localhost')
EMAIL_PORT = os.getenv('DJANGO_EMAIL_PORT', 25)
EMAIL_HOST_USER = os.getenv('DJANGO_EMAIL_USER', 'no-reply@localhost')
EMAIL_HOST_PASSWORD = os.getenv('DJANGO_EMAIL_PASSWORD', 'smtp-secret')
EMAIL_USE_TLS = bool(os.getenv('DJANGO_EMAIL_USE_TLS', '1'))
DEFAULT_FROM_EMAIL = os.getenv('DJANGO_EMAIL_FROM', 'no-reply@localhost')
EMAIL_REPLY_TO = os.getenv('DJANGO_EMAIL_REPLY_TO', 'info@localhost')
EMAIL_BACKEND = 'post_office.EmailBackend'
############################################
# settings for third party Django apps
NODE_MODULES_URL = STATIC_URL + 'node_modules/'
SASS_PROCESSOR_INCLUDE_DIRS = [
os.path.join(PROJECT_ROOT, 'node_modules'),
]
COERCE_DECIMAL_TO_STRING = True
FSM_ADMIN_FORCE_PERMIT = True
ROBOTS_META_TAGS = ('noindex', 'nofollow')
SERIALIZATION_MODULES = {'json': str('shop.money.serializers')}
############################################
# settings for django-restframework and plugins
REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': [
'shop.rest.money.JSONRenderer',
# can be disabled for production environments
'rest_framework.renderers.BrowsableAPIRenderer',
],
'DEFAULT_FILTER_BACKENDS': [
'django_filters.rest_framework.DjangoFilterBackend',
],
# 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
# 'PAGE_SIZE': 16,
}
REST_AUTH_SERIALIZERS = {
'LOGIN_SERIALIZER': 'shop.serializers.auth.LoginSerializer',
}
############################################
# settings for storing files and images
FILER_ADMIN_ICON_SIZES = ('16', '32', '48', '80', '128')
FILER_ALLOW_REGULAR_USERS_TO_ADD_ROOT_FOLDERS = True
FILER_DUMP_PAYLOAD = False
FILE_UPLOAD_MAX_MEMORY_SIZE = 5242880
THUMBNAIL_HIGH_RESOLUTION = False
THUMBNAIL_PRESERVE_EXTENSIONS = True
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
)
############################################
# settings for django-cms and its plugins
CMS_TEMPLATES = [
('weirdlittleempire/pages/default.html', "Default Page"),
]
CMS_CACHE_DURATIONS = {
'content': 600,
'menus': 3600,
'permissions': 86400,
}
CMS_PERMISSION = True
CMS_PLACEHOLDER_CONF = {
'Breadcrumb': {
'plugins': ['BreadcrumbPlugin'],
'parent_classes': {'BreadcrumbPlugin': None},
},
'Commodity Details': {
'plugins': ['BootstrapContainerPlugin', 'BootstrapJumbotronPlugin'],
'parent_classes': {
'BootstrapContainerPlugin': None,
'BootstrapJumbotronPlugin': None,
},
},
'Main Content': {
'plugins': ['BootstrapContainerPlugin', 'BootstrapJumbotronPlugin'],
'parent_classes': {
'BootstrapContainerPlugin': None,
'BootstrapJumbotronPlugin': None,
'TextLinkPlugin': ['TextPlugin', 'AcceptConditionPlugin'],
},
},
'Static Footer': {
'plugins': ['BootstrapContainerPlugin', 'BootstrapJumbotronPlugin'],
'parent_classes': {
'BootstrapContainerPlugin': None,
'BootstrapJumbotronPlugin': None,
},
},
}
CMSPLUGIN_CASCADE_PLUGINS = [
'cmsplugin_cascade.bootstrap4',
'cmsplugin_cascade.segmentation',
'cmsplugin_cascade.generic',
'cmsplugin_cascade.icon',
'cmsplugin_cascade.leaflet',
'cmsplugin_cascade.link',
'shop.cascade',
]
CMSPLUGIN_CASCADE = {
'link_plugin_classes': [
'shop.cascade.plugin_base.CatalogLinkPluginBase',
'shop.cascade.plugin_base.CatalogLinkForm',
],
'alien_plugins': ['TextPlugin', 'TextLinkPlugin', 'AcceptConditionPlugin'],
'bootstrap4': {
'template_basedir': 'angular-ui/',
},
'plugins_with_extra_render_templates': {
'CustomSnippetPlugin': [
('shop/catalog/product-heading.html', _("Product Heading")),
('weirdlittleempire/catalog/manufacturer-filter.html',
_("Manufacturer Filter")),
],
# required to purchase real estate
'ShopAddToCartPlugin': [
(None, _("Default")),
('weirdlittleempire/catalog/commodity-add2cart.html',
_("Add Commodity to Cart")),
],
},
'plugins_with_sharables': {
'BootstrapImagePlugin': ['image_shapes', 'image_width_responsive', 'image_width_fixed',
'image_height', 'resize_options'],
'BootstrapPicturePlugin': ['image_shapes', 'responsive_heights', 'responsive_zoom', 'resize_options'],
},
'plugins_with_extra_fields': {
'BootstrapCardPlugin': PluginExtraFieldsConfig(),
'BootstrapCardHeaderPlugin': PluginExtraFieldsConfig(),
'BootstrapCardBodyPlugin': PluginExtraFieldsConfig(),
'BootstrapCardFooterPlugin': PluginExtraFieldsConfig(),
'SimpleIconPlugin': PluginExtraFieldsConfig(),
},
'plugins_with_extra_mixins': {
'BootstrapContainerPlugin': BootstrapUtilities(),
'BootstrapRowPlugin': BootstrapUtilities(BootstrapUtilities.paddings),
'BootstrapYoutubePlugin': BootstrapUtilities(BootstrapUtilities.margins),
'BootstrapButtonPlugin': BootstrapUtilities(BootstrapUtilities.floats),
},
'leaflet': {
'tilesURL': 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}',
'accessToken': 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw',
'apiKey': 'AIzaSyD71sHrtkZMnLqTbgRmY_NsO0A9l9BQmv4',
},
'bookmark_prefix': '/',
'segmentation_mixins': [
('shop.cascade.segmentation.EmulateCustomerModelMixin',
'shop.cascade.segmentation.EmulateCustomerAdminMixin'),
],
'allow_plugin_hiding': True,
'register_page_editor': True,
}
CKEDITOR_SETTINGS = {
'language': '{{ language }}',
'skin': 'moono-lisa',
'toolbar_CMS': [
['Undo', 'Redo'],
['cmsplugins', '-', 'ShowBlocks'],
['Format'],
['TextColor', 'BGColor', '-', 'PasteText', 'PasteFromWord'],
'/',
['Bold', 'Italic', 'Underline', 'Strike', '-',
'Subscript', 'Superscript', '-', 'RemoveFormat'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['HorizontalRule'],
['NumberedList', 'BulletedList', 'Outdent', 'Indent'],
['Table', 'Source']
],
'stylesSet': format_lazy('default:{}', reverse_lazy('admin:cascade_texteditor_config')),
}
CKEDITOR_SETTINGS_CAPTION = {
'language': '{{ language }}',
'skin': 'moono-lisa',
'height': 70,
'toolbar_HTMLField': [
['Undo', 'Redo'],
['Format', 'Styles'],
['Bold', 'Italic', 'Underline', '-', 'Subscript',
'Superscript', '-', 'RemoveFormat'],
['Source']
],
}
CKEDITOR_SETTINGS_DESCRIPTION = {
'language': '{{ language }}',
'skin': 'moono-lisa',
'height': 250,
'toolbar_HTMLField': [
['Undo', 'Redo'],
['cmsplugins', '-', 'ShowBlocks'],
['Format', 'Styles'],
['TextColor', 'BGColor', '-', 'PasteText', 'PasteFromWord'],
['Maximize', ''],
'/',
['Bold', 'Italic', 'Underline', '-', 'Subscript',
'Superscript', '-', 'RemoveFormat'],
['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
['HorizontalRule'],
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'],
['Source']
],
}
SELECT2_CSS = 'node_modules/select2/dist/css/select2.min.css'
SELECT2_JS = 'node_modules/select2/dist/js/select2.min.js'
SELECT2_I18N_PATH = 'node_modules/select2/dist/js/i18n'
#############################################
# settings for full index text search
ELASTICSEARCH_HOST = os.getenv('ELASTICSEARCH_HOST', 'localhost')
ELASTICSEARCH_DSL = {
'default': {
'hosts': '{}:9200'.format(ELASTICSEARCH_HOST)
},
}
############################################
# settings for django-shop and its plugins
SHOP_VALUE_ADDED_TAX = Decimal(19)
SHOP_DEFAULT_CURRENCY = 'EUR'
SHOP_EDITCART_NG_MODEL_OPTIONS = "{updateOn: 'default blur', debounce: {'default': 2500, 'blur': 0}}"
SHOP_CART_MODIFIERS = [
'weirdlittleempire.modifiers.PrimaryCartModifier',
'shop.modifiers.taxes.CartExcludedTaxModifier',
'weirdlittleempire.modifiers.PostalShippingModifier',
'weirdlittleempire.modifiers.StripePaymentModifier',
'shop.payment.modifiers.PayInAdvanceModifier',
'shop.shipping.modifiers.SelfCollectionModifier',
]
SHOP_ORDER_WORKFLOWS = [
'shop.payment.workflows.ManualPaymentWorkflowMixin',
'shop.payment.workflows.CancelOrderWorkflowMixin',
'shop.shipping.workflows.PartialDeliveryWorkflowMixin',
'shop_stripe.workflows.OrderWorkflowMixin',
]
SHOP_STRIPE = {
'PUBKEY': os.getenv('STRIPE_PUBKEY', 'pk_test_HlEp5oZyPonE21svenqowhXp'),
'APIKEY': os.getenv('STRIPE_APIKEY', 'sk_test_xUdHLeFasmOUDvmke4DHGRDP'),
'PURCHASE_DESCRIPTION': _("Thanks for purchasing at Weird Little Empire"),
}
SHOP_STRIPE_PREFILL = True
SHOP_CASCADE_FORMS = {
'CustomerForm': 'weirdlittleempire.forms.CustomerForm',
}

View File

@@ -0,0 +1,12 @@
from django.contrib.sitemaps import Sitemap
from django.conf import settings
from weirdlittleempire.models import Product
class ProductSitemap(Sitemap):
changefreq = 'monthly'
priority = 0.5
i18n = settings.USE_I18N
def items(self):
return Product.objects.filter(active=True)

View File

@@ -0,0 +1,35 @@
@import "variables";
html {
height: 100%;
&.cms-toolbar-expanded {
// prevents pushing a sticky footer outside the vertical viewport if CMS toolbar is active
height: calc(100% - 46px);
}
}
body {
display: flex;
height: 100%;
flex-direction: column;
main {
flex: 1 0 auto;
padding-bottom: $body-footer-margin;
}
footer {
flex-shrink: 0;
color: $body-footer-color;
background: $body-footer-bg;
padding-top: $body-footer-margin;
padding-bottom: $body-footer-margin;
a {
color: $body-footer-link-color;
text-decoration: none;
&:hover {
color: $body-footer-link-hover-color;
}
&:active {
color: $body-footer-link-active-color;
}
}
}
}

View File

@@ -0,0 +1,103 @@
@import "variables";
@import "shop/css/navbar";
body {
padding-top: $body-header-height;
@include media-breakpoint-up(lg) {
padding-top: $body-header-lg-height;
}
.navbar {
$navbar: &;
@include media-breakpoint-up(lg) {
height: $body-header-lg-height;
transition: height 500ms ease, box-shadow 250ms ease;
padding-top: 0;
padding-bottom: 0;
.navbar-nav, .navbar-collapse, >.container {
height: 100% !important;
}
&.scrolled {
height: 75px;
box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.075);
.shop-brand-icon {
height: 32px;
}
}
.nav-link {
padding-top: 0.25rem;
padding-bottom: 0.25rem;
}
}
.shop-brand-icon {
height: 48px;
transition: height 500ms ease;
position: absolute;
padding-top: 0.5rem;
top: 0;
left: 0;
right: 0;
display: flex;
justify-content: center;
pointer-events: none;
a {
width: min-content;
}
img {
height: 100%;
width: auto;
margin: auto;
display: block;
pointer-events: auto;
}
}
.shop-social-icons {
.nav-link {
display: inline-block;
padding-left: 0.25rem;
padding-right: 0.25rem;
}
@include media-breakpoint-down(md) {
order: 4;
.nav-link {
margin-left: 0.25rem;
margin-right: 0.5rem;
}
}
@include media-breakpoint-up(lg) {
align-self: flex-end;
}
.cms-placeholder {
display: inline-block;
}
}
.shop-primary-menu {
font-size: 125%;
font-weight: 300;
@include media-breakpoint-down(md) {
order: 1;
}
@include media-breakpoint-up(lg) {
font-size: 150%;
.dropdown-toggle::after {
font-size: initial;
}
}
}
.shop-secondary-menu {
@include media-breakpoint-down(md) {
order: 2;
}
@include media-breakpoint-up(lg) {
align-self: flex-end;
}
}
.shop-search-form {
@include media-breakpoint-down(md) {
order: 3;
}
@include media-breakpoint-up(lg) {
margin-left: auto;
}
}
}
}

View File

@@ -0,0 +1,14 @@
@import "shop/css/variables";
// header
$body-header-height: 50px;
$body-header-lg-height: 90px;
// footer
$body-footer-margin: 1rem;
$body-footer-color: $white;
$body-footer-bg: $gray-900;
$body-footer-border: $gray-900;
$body-footer-link-color: darken($body-footer-color, 15%);
$body-footer-link-hover-color: $body-footer-color;
$body-footer-link-active-color: $body-footer-color;

View File

@@ -0,0 +1,5 @@
@import "variables";
@import "font-awesome/scss/font-awesome";
@import "shop/css/django-shop";
@import "navbar";
@import "footer";

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
width="453.54px"
height="85.04px"
viewBox="0 0 453.54 85.04"
enable-background="new 0 0 453.54 85.04"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="django-shop-logo.svg"><metadata
id="metadata31"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs29" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2091"
inkscape:window-height="1115"
id="namedview27"
showgrid="false"
inkscape:zoom="0.79816553"
inkscape:cx="152.22406"
inkscape:cy="42.52"
inkscape:window-x="1440"
inkscape:window-y="1"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" /><g
id="g4195"
inkscape:export-xdpi="44.479092"
inkscape:export-ydpi="44.479092"><g
id="g4189"><path
id="path5"
d="m 245.27,46.11 c 6.24,4.24 10.48,5.681 16.24,5.681 5.6,0 8.801,-2 8.801,-5.44 0,-3.2 -1.439,-4.56 -9.6,-8.64 -6.641,-3.28 -9.121,-4.96 -11.441,-7.521 -2.32,-2.48 -3.52,-5.92 -3.52,-9.76 0,-10.4 8.24,-16.96 21.439,-16.96 5.762,0 11.041,1.2 15.762,3.6 l 0,12.24 c -4.961,-3.52 -9.281,-4.96 -14.801,-4.96 -5.84,0 -9.201,1.92 -9.201,5.28 0,2.24 1.602,3.92 5.201,5.6 l 4.801,2.32 c 5.76,2.64 8.479,4.4 10.959,6.88 2.881,2.88 4.4,6.8 4.4,11.281 0,10.72 -8.48,17.359 -22,17.359 -6.08,0 -11.761,-1.279 -17.041,-3.84 l 0,-13.12 z"
inkscape:connector-curvature="0"
style="fill:#43b68b" /><path
id="path7"
d="m 289.59,4.51 13.359,0 0,22.32 22.801,0 0,-22.32 13.361,0 0,57.121 -13.361,0 0,-23.521 -22.801,0 0,23.521 -13.359,0 0,-57.121 z"
inkscape:connector-curvature="0"
style="fill:#43b68b" /><path
id="path9"
d="m 373.67,3.39 c 17.279,0 28.16,11.44 28.16,29.44 0,18.48 -11.201,30.081 -29.041,30.081 -17.52,0 -28.4,-11.2 -28.4,-29.121 0,-18.56 11.359,-30.4 29.281,-30.4 z m -0.561,48.241 c 9.201,0 14.721,-6.961 14.721,-18.721 0,-11.68 -5.361,-18.641 -14.48,-18.641 -9.361,0 -14.961,7.041 -14.961,18.721 0,11.76 5.441,18.641 14.72,18.641 z"
inkscape:connector-curvature="0"
style="fill:#43b68b" /><path
id="path11"
d="m 407.428,4.91 1.279,-0.08 c 6.08,-0.4 10.961,-0.64 15.441,-0.64 8.799,0 14.08,1.2 18.32,4.24 4.48,3.2 7.039,8.48 7.039,14.72 0,6.4 -2.879,11.92 -8,14.88 -4.24,2.48 -9.359,3.6 -16.561,3.6 -1.119,0 -2.24,-0.08 -4.16,-0.16 l 0,20.161 -13.359,0 0,-56.721 z m 13.359,26 c 1.361,0.24 2.24,0.24 3.281,0.24 8.721,0 12.24,-2.4 12.24,-8.161 0,-5.6 -3.52,-8.32 -10.561,-8.32 -1.359,0 -2.561,0 -4.961,0.4 l 0,15.841 z"
inkscape:connector-curvature="0"
style="fill:#43b68b" /></g><g
id="g13"><path
id="path15"
d="m 31.092,3.071 12.401,0 0,57.404 c -6.361,1.207 -11.033,1.69 -16.107,1.69 -15.138,0 -23.032,-6.847 -23.032,-19.973 0,-12.643 8.378,-20.857 21.342,-20.857 2.013,0 3.543,0.16 5.396,0.646 l 0,-18.91 z m 0,28.895 c -1.45,-0.481 -2.657,-0.642 -4.188,-0.642 -6.282,0 -9.906,3.865 -9.906,10.63 0,6.604 3.463,10.226 9.826,10.226 1.369,0 2.495,-0.08 4.268,-0.32 l 0,-19.894 z"
inkscape:connector-curvature="0"
style="fill:#082e20" /><path
id="path17"
d="m 63.223,22.225 0,28.749 c 0,9.904 -0.725,14.656 -2.9,18.762 -2.012,3.946 -4.67,6.443 -10.146,9.181 L 38.661,73.44 c 5.477,-2.576 8.134,-4.831 9.824,-8.293 1.772,-3.543 2.335,-7.65 2.335,-18.443 l 0,-24.479 12.403,0 z M 50.82,3.137 l 12.403,0 0,12.726 -12.403,0 0,-12.726 z"
inkscape:connector-curvature="0"
style="fill:#082e20" /><path
id="path19"
d="m 70.712,25.042 c 5.478,-2.576 10.711,-3.706 16.431,-3.706 6.36,0 10.548,1.692 12.4,4.994 1.047,1.852 1.369,4.268 1.369,9.422 l 0,25.206 c -5.558,0.806 -12.562,1.37 -17.715,1.37 -10.389,0 -15.061,-3.625 -15.061,-11.678 0,-8.696 6.2,-12.723 21.421,-14.012 l 0,-2.737 c 0,-2.255 -1.126,-3.062 -4.268,-3.062 -4.59,0 -9.744,1.29 -14.578,3.785 l 0,-9.582 z m 19.409,19.729 c -8.212,0.806 -10.872,2.096 -10.872,5.313 0,2.419 1.53,3.546 4.913,3.546 1.853,0 3.543,-0.16 5.959,-0.564 l 0,-8.295 z"
inkscape:connector-curvature="0"
style="fill:#082e20" /><path
id="path21"
d="m 106.952,24.155 c 7.329,-1.931 13.368,-2.819 19.489,-2.819 6.362,0 10.951,1.45 13.69,4.269 2.576,2.657 3.382,5.557 3.382,11.758 l 0,24.319 -12.402,0 0,-23.835 c 0,-4.751 -1.611,-6.523 -6.038,-6.523 -1.692,0 -3.221,0.161 -5.719,0.884 l 0,29.475 -12.402,0 0,-37.528 z"
inkscape:connector-curvature="0"
style="fill:#082e20" /><path
id="path23"
d="m 148.334,68.446 c 4.351,2.256 8.698,3.303 13.288,3.303 8.135,0 11.597,-3.303 11.597,-11.194 0,-0.079 0,-0.159 0,-0.241 -2.415,1.209 -4.83,1.69 -8.052,1.69 -10.872,0 -17.798,-7.166 -17.798,-18.521 0,-14.095 10.227,-22.066 28.347,-22.066 5.314,0 10.226,0.565 16.187,1.774 l -4.246,8.945 c -3.303,-0.646 -0.264,-0.088 -2.759,-0.33 l 0,1.291 0.16,5.233 0.081,6.765 c 0.081,1.692 0.081,3.385 0.162,5.073 0,1.531 0,2.256 0,3.385 0,10.63 -0.886,15.623 -3.545,19.729 -3.865,6.04 -10.549,9.02 -20.05,9.02 -4.833,0 -9.02,-0.727 -13.371,-2.416 l 0,-11.44 z m 24.644,-37.04 c -0.163,0 -0.322,0 -0.404,0 l -0.885,0 c -2.417,-0.082 -5.234,0.56 -7.166,1.769 -2.982,1.692 -4.51,4.753 -4.51,9.099 0,6.204 3.059,9.746 8.536,9.746 1.689,0 3.06,-0.322 4.67,-0.805 l 0,-0.888 0,-3.38 c 0,-1.45 -0.08,-3.062 -0.08,-4.754 l -0.08,-5.715 -0.081,-4.107 0,-0.965 z"
inkscape:connector-curvature="0"
style="fill:#082e20" /><path
id="path25"
d="m 211.155,21.177 c 12.399,0 19.971,7.812 19.971,20.455 0,12.966 -7.892,21.099 -20.456,21.099 -12.401,0 -20.052,-7.811 -20.052,-20.376 0,-13.047 7.893,-21.178 20.537,-21.178 z m -0.243,31.565 c 4.751,0 7.569,-3.945 7.569,-10.788 0,-6.766 -2.737,-10.792 -7.487,-10.792 -4.911,0 -7.732,3.947 -7.732,10.792 0,6.843 2.821,10.788 7.65,10.788 z"
inkscape:connector-curvature="0"
style="fill:#082e20" /></g></g></svg>

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,695 @@
{
"plugins":[
[
"BootstrapContainerPlugin",
{
"glossary":{
"media_queries":{
"xs":[
"(max-width: 768px)"
],
"lg":[
"(min-width: 1200px)"
],
"sm":[
"(min-width: 768px)",
"(max-width: 992px)"
],
"md":[
"(min-width: 992px)",
"(max-width: 1200px)"
]
},
"container_max_widths":{
"xs":750,
"lg":1170,
"sm":750,
"md":970
},
"extra_inline_styles:Paddings":{
"padding-top":"",
"padding-bottom":"30px"
},
"fluid":"",
"breakpoints":[
"xs",
"sm",
"md",
"lg"
]
},
"pk":14488
},
[
[
"SegmentPlugin",
{
"glossary":{
"open_tag":"if",
"condition":"customer.is_recognized"
},
"pk":14489
},
[
[
"BootstrapRowPlugin",
{
"glossary":{
"extra_css_classes":[
"foo",
"bar",
"cap"
],
"hide_plugin":"",
"extra_inline_styles:Margins":{
"margin-top":"",
"margin-bottom":"20px"
}
},
"pk":14490
},
[
[
"BootstrapColumnPlugin",
{
"glossary":{
"sm-responsive-utils":"",
"xs-responsive-utils":"",
"md-column-offset":"",
"sm-column-width":"col-sm-10",
"md-responsive-utils":"",
"xs-column-offset":"",
"sm-column-offset":"col-sm-offset-1",
"sm-column-ordering":"",
"md-column-ordering":"",
"lg-column-ordering":"",
"lg-column-offset":"col-lg-offset-2",
"md-column-width":"",
"xs-column-width":"col-xs-12",
"lg-responsive-utils":"",
"container_max_widths":{
"xs":720.0,
"lg":750.0,
"sm":595.0,
"md":778.33
},
"lg-column-width":"col-lg-8",
"xs-column-ordering":""
},
"pk":14491
},
[
[
"ProcessBarPlugin",
{
"glossary":{},
"pk":14492
},
[
[
"ProcessStepPlugin",
{
"glossary":{
"hide_plugin":"",
"step_title":"Addresses"
},
"pk":14500
},
[
[
"CheckoutAddressPlugin",
{
"glossary":{
"allow_use_primary":"",
"allow_multiple":"on",
"address_form":"shipping",
"render_type":"form",
"hide_plugin":"",
"headline_legend":"on"
},
"pk":14503
},
[]
],
[
"CheckoutAddressPlugin",
{
"glossary":{
"allow_use_primary":"on",
"allow_multiple":"on",
"address_form":"billing",
"render_type":"form",
"hide_plugin":"",
"headline_legend":"on"
},
"pk":14504
},
[]
],
[
"RequiredFormFieldsPlugin",
{
"glossary":{},
"pk":14502
},
[]
],
[
"ProcessNextStepPlugin",
{
"glossary":{
"icon_align":"icon-right",
"symbol":"right-open",
"button_size":"",
"quick_float":"pull-right",
"button_options":[],
"icon_font":"4",
"link_content":"Next",
"button_type":"btn-success",
"hide_plugin":""
},
"pk":14501
},
[]
]
]
],
[
"ProcessStepPlugin",
{
"glossary":{
"step_title":"Customer"
},
"pk":14493
},
[
[
"SegmentPlugin",
{
"glossary":{
"open_tag":"if",
"condition":"customer.is_registered"
},
"pk":14494
},
[
[
"CustomerFormPlugin",
{
"glossary":{
"render_type":"form"
},
"pk":14495
},
[]
]
]
],
[
"SegmentPlugin",
{
"glossary":{
"open_tag":"else",
"condition":""
},
"pk":14496
},
[
[
"GuestFormPlugin",
{
"glossary":{
"render_type":"form"
},
"pk":14497
},
[]
]
]
],
[
"RequiredFormFieldsPlugin",
{
"glossary":{},
"pk":14499
},
[]
],
[
"ProcessNextStepPlugin",
{
"glossary":{
"icon_align":"icon-right",
"symbol":"right-open",
"button_size":"",
"quick_float":"pull-right",
"button_options":[],
"icon_font":"4",
"link_content":"Next",
"button_type":"btn-success",
"hide_plugin":""
},
"pk":14498
},
[]
]
]
],
[
"ProcessStepPlugin",
{
"glossary":{
"hide_plugin":"",
"step_title":"Payment"
},
"pk":14505
},
[
[
"HeadingPlugin",
{
"glossary":{
"content":"Bezahlen und Versenden",
"element_id":"",
"tag_type":"h3"
},
"pk":14512
},
[]
],
[
"ShopCartPlugin",
{
"glossary":{
"render_type":"summary"
},
"pk":14511
},
[]
],
[
"PaymentMethodFormPlugin",
{
"glossary":{
"render_type":"form"
},
"pk":14506
},
[]
],
[
"ShippingMethodFormPlugin",
{
"glossary":{
"render_type":"form"
},
"pk":14507
},
[]
],
[
"ExtraAnnotationFormPlugin",
{
"glossary":{
"render_type":"form"
},
"pk":14508
},
[]
],
[
"RequiredFormFieldsPlugin",
{
"glossary":{},
"pk":14509
},
[]
],
[
"ProcessNextStepPlugin",
{
"glossary":{
"icon_align":"icon-right",
"symbol":"right-open",
"button_size":"",
"quick_float":"pull-right",
"button_options":[],
"icon_font":"4",
"link_content":"Next",
"button_type":"btn-success",
"hide_plugin":""
},
"pk":14510
},
[]
]
]
],
[
"ProcessStepPlugin",
{
"glossary":{
"hide_plugin":"",
"step_title":"Summary"
},
"pk":14513
},
[
[
"HeadingPlugin",
{
"glossary":{
"content":"Summary of your Order",
"element_id":"",
"tag_type":"h3",
"hide_plugin":"",
"extra_inline_styles:Margins":{
"margin-right":"",
"margin-top":"",
"margin-left":"",
"margin-bottom":""
}
},
"pk":14518
},
[]
],
[
"ShopCartPlugin",
{
"glossary":{
"render_type":"static"
},
"pk":14514
},
[]
],
[
"SegmentPlugin",
{
"glossary":{
"open_tag":"if",
"condition":"customer.is_registered"
},
"pk":14519
},
[
[
"CustomerFormPlugin",
{
"glossary":{
"render_type":"summary"
},
"pk":14520
},
[]
]
]
],
[
"SegmentPlugin",
{
"glossary":{
"open_tag":"else",
"condition":""
},
"pk":14521
},
[
[
"GuestFormPlugin",
{
"glossary":{
"render_type":"summary"
},
"pk":14522
},
[]
]
]
],
[
"PaymentMethodFormPlugin",
{
"glossary":{
"render_type":"summary"
},
"pk":14515
},
[]
],
[
"ShippingMethodFormPlugin",
{
"glossary":{
"render_type":"summary"
},
"pk":14516
},
[]
],
[
"ExtraAnnotationFormPlugin",
{
"glossary":{
"render_type":"summary"
},
"pk":14517
},
[]
],
[
"AcceptConditionPlugin",
{
"body":"<p>I have read the <cms-plugin id=\"14526\" alt=\"Link - terms and conditions \" title=\"Link - terms and conditions\"></cms-plugin> and agree with them.</p>",
"pk":14525
},
[
[
"TextLinkPlugin",
{
"glossary":{
"link_content":"terms and conditions",
"link":{
"pk":15,
"model":"cms.Page",
"type":"cmspage",
"section":""
},
"target":"",
"title":""
},
"pk":14526
},
[]
]
]
],
[
"RequiredFormFieldsPlugin",
{
"glossary":{},
"pk":14523
},
[]
],
[
"ShopProceedButton",
{
"glossary":{
"icon_align":"icon-right",
"symbol":"right-hand",
"button_size":"btn-lg",
"quick_float":"",
"button_options":[],
"icon_font":"4",
"link_content":"Purchase Now",
"link":{
"type":"PURCHASE_NOW"
},
"button_type":"btn-success",
"hide_plugin":""
},
"pk":14524
},
[]
]
]
]
]
]
]
]
]
]
]
],
[
"SegmentPlugin",
{
"glossary":{
"open_tag":"else",
"condition":""
},
"pk":14527
},
[
[
"BootstrapRowPlugin",
{
"glossary":{
"extra_inline_styles:Paddings":{
"padding-right":"",
"padding-left":""
},
"extra_inline_styles:Margins":{
"margin-top":"",
"margin-bottom":"20px"
}
},
"pk":14528
},
[
[
"BootstrapColumnPlugin",
{
"glossary":{
"sm-responsive-utils":"",
"xs-responsive-utils":"",
"lg-column-offset":"",
"sm-column-width":"col-sm-4",
"md-responsive-utils":"",
"xs-column-offset":"",
"md-column-offset":"",
"sm-column-ordering":"",
"sm-column-offset":"",
"lg-column-ordering":"",
"lg-column-width":"",
"xs-column-ordering":"",
"xs-column-width":"col-xs-12",
"lg-responsive-utils":"",
"container_max_widths":{
"xs":720.0,
"lg":360.0,
"sm":220.0,
"md":293.33
},
"md-column-width":"",
"md-column-ordering":""
},
"pk":14529
},
[
[
"ShopAuthenticationPlugin",
{
"glossary":{
"form_type":"login-reset",
"link":{
"type":"RELOAD_PAGE"
}
},
"pk":14530
},
[]
]
]
],
[
"BootstrapColumnPlugin",
{
"glossary":{
"sm-responsive-utils":"",
"xs-responsive-utils":"",
"md-column-offset":"",
"sm-column-width":"col-sm-4",
"md-responsive-utils":"",
"xs-column-offset":"",
"sm-column-offset":"",
"sm-column-ordering":"",
"md-column-ordering":"",
"lg-column-ordering":"",
"lg-column-offset":"",
"md-column-width":"",
"xs-column-width":"col-xs-12",
"lg-responsive-utils":"",
"container_max_widths":{
"xs":720.0,
"lg":360.0,
"sm":220.0,
"md":293.33
},
"lg-column-width":"",
"xs-column-ordering":""
},
"pk":14531
},
[
[
"ShopAuthenticationPlugin",
{
"glossary":{
"form_type":"register-user",
"link":{
"type":"RELOAD_PAGE"
}
},
"pk":14532
},
[]
]
]
],
[
"BootstrapColumnPlugin",
{
"glossary":{
"sm-responsive-utils":"",
"xs-responsive-utils":"",
"md-column-offset":"",
"sm-column-width":"col-sm-4",
"md-responsive-utils":"",
"xs-column-offset":"",
"sm-column-offset":"",
"sm-column-ordering":"",
"md-column-ordering":"",
"lg-column-ordering":"",
"lg-column-offset":"",
"md-column-width":"",
"xs-column-width":"col-xs-12",
"lg-responsive-utils":"",
"container_max_widths":{
"xs":720.0,
"lg":360.0,
"sm":220.0,
"md":293.33
},
"lg-column-width":"",
"xs-column-ordering":""
},
"pk":14533
},
[
[
"ShopAuthenticationPlugin",
{
"glossary":{
"form_type":"continue-as-guest",
"link":{
"type":"RELOAD_PAGE"
}
},
"pk":14534
},
[]
]
]
]
]
]
]
]
]
]
]
}

View File

@@ -0,0 +1,317 @@
{
"plugins":[
[
"BootstrapContainerPlugin",
{
"glossary":{
"media_queries":{
"xs":[
"(max-width: 768px)"
],
"lg":[
"(min-width: 1200px)"
],
"sm":[
"(min-width: 768px)",
"(max-width: 992px)"
],
"md":[
"(min-width: 992px)",
"(max-width: 1200px)"
]
},
"container_max_widths":{
"xs":750,
"lg":1170,
"sm":750,
"md":970
},
"hide_plugin":"",
"fluid":"",
"breakpoints":[
"xs",
"sm",
"md",
"lg"
]
},
"pk":9086
},
[
[
"BootstrapRowPlugin",
{
"glossary":{
"extra_css_classes":[],
"hide_plugin":"",
"extra_inline_styles:Margins":{
"margin-top":"",
"margin-bottom":""
}
},
"pk":9087
},
[
[
"BootstrapColumnPlugin",
{
"glossary":{
"container_max_widths":{
"xs":157.5,
"lg":262.5,
"sm":157.5,
"md":212.5
},
"xs-column-width":"col-xs-3"
},
"pk":9088
},
[
[
"HeadingPlugin",
{
"glossary":{
"content":"ABOUT US",
"element_id":"",
"extra_inline_styles:Margins":{
"margin-top":"",
"margin-bottom":"",
"margin-left":"",
"margin-right":""
},
"hide_plugin":"",
"tag_type":"h4"
},
"pk":9089
},
[]
],
[
"BootstrapSecondaryMenuPlugin",
{
"glossary":{
"limit":"3",
"page_id":"shop-about",
"hide_plugin":"",
"render_template":"cascade/bootstrap3/secmenu-unstyled-list.html",
"offset":"0"
},
"pk":9090
},
[]
]
]
],
[
"BootstrapColumnPlugin",
{
"glossary":{
"container_max_widths":{
"xs":157.5,
"lg":262.5,
"sm":157.5,
"md":212.5
},
"xs-column-width":"col-xs-3"
},
"pk":9091
},
[
[
"HeadingPlugin",
{
"glossary":{
"content":"HELP &amp; CONTACT",
"element_id":"",
"extra_inline_styles:Margins":{
"margin-top":"",
"margin-bottom":"",
"margin-left":"",
"margin-right":""
},
"hide_plugin":"",
"tag_type":"h4"
},
"pk":9092
},
[]
],
[
"BootstrapSecondaryMenuPlugin",
{
"glossary":{
"limit":"100",
"page_id":"shop-contact",
"hide_plugin":"",
"render_template":"cascade/bootstrap3/secmenu-unstyled-list.html",
"offset":"0"
},
"pk":9093
},
[]
]
]
],
[
"BootstrapColumnPlugin",
{
"glossary":{
"container_max_widths":{
"xs":157.5,
"lg":262.5,
"sm":157.5,
"md":212.5
},
"xs-column-width":"col-xs-3"
},
"pk":9094
},
[
[
"HeadingPlugin",
{
"glossary":{
"content":"MORE FROM US",
"element_id":"",
"extra_inline_styles:Margins":{
"margin-top":"",
"margin-bottom":"",
"margin-left":"",
"margin-right":""
},
"hide_plugin":"",
"tag_type":"h4"
},
"pk":9095
},
[]
],
[
"BootstrapSecondaryMenuPlugin",
{
"glossary":{
"limit":"3",
"page_id":"shop-more",
"hide_plugin":"",
"render_template":"cascade/bootstrap3/secmenu-unstyled-list.html",
"offset":"0"
},
"pk":9096
},
[]
]
]
],
[
"BootstrapColumnPlugin",
{
"glossary":{
"container_max_widths":{
"xs":157.5,
"lg":262.5,
"sm":157.5,
"md":212.5
},
"xs-column-width":"col-xs-3"
},
"pk":9097
},
[
[
"SegmentPlugin",
{
"glossary":{
"open_tag":"if",
"condition":"user.is_anonymous"
},
"pk":9098
},
[
[
"HeadingPlugin",
{
"glossary":{
"content":"Join Us",
"element_id":"",
"extra_inline_styles:Margins":{
"margin-top":"",
"margin-bottom":"",
"margin-left":"",
"margin-right":""
},
"hide_plugin":"",
"tag_type":"h4"
},
"pk":9099
},
[]
],
[
"BootstrapSecondaryMenuPlugin",
{
"glossary":{
"page_id":"shop-membership",
"limit":"100",
"hide_plugin":"",
"render_template":"cascade/bootstrap3/secmenu-unstyled-list.html",
"offset":"0"
},
"pk":9100
},
[]
]
]
],
[
"SegmentPlugin",
{
"glossary":{
"open_tag":"else",
"condition":""
},
"pk":9101
},
[
[
"HeadingPlugin",
{
"glossary":{
"content":"YOUR ACCOUNT",
"element_id":"",
"extra_inline_styles:Margins":{
"margin-top":"",
"margin-bottom":"",
"margin-left":"",
"margin-right":""
},
"hide_plugin":"",
"tag_type":"h4"
},
"pk":9102
},
[]
],
[
"BootstrapSecondaryMenuPlugin",
{
"glossary":{
"page_id":"shop-personal",
"limit":"3",
"hide_plugin":"",
"render_template":"cascade/bootstrap3/secmenu-unstyled-list.html",
"offset":"0"
},
"pk":9103
},
[]
]
]
]
]
]
]
]
]
]
]
}

View File

@@ -0,0 +1,859 @@
{
"plugins":[
[
"BootstrapJumbotronPlugin",
{
"glossary":{
"background_width_height":{
"width":"",
"height":""
},
"background_vertical_position":"center",
"media_queries":{
"xs":[
"(max-width: 768px)"
],
"lg":[
"(min-width: 1200px)"
],
"sm":[
"(min-width: 768px)",
"(max-width: 992px)"
],
"md":[
"(min-width: 992px)",
"(max-width: 1200px)"
]
},
"background_attachment":"fixed",
"image":{
"pk":184,
"model":"filer.Image"
},
"background_repeat":"no-repeat",
"hide_plugin":"",
"fluid":true,
"container_max_heights":{
"xs":"100%",
"md":"100%",
"sm":"100%",
"lg":"100%"
},
"extra_inline_styles:Paddings":{
"padding-top":"500px",
"padding-bottom":""
},
"background_size":"cover",
"resize_options":[
"crop",
"subject_location",
"high_resolution"
],
"container_max_widths":{
"xs":768,
"lg":1980,
"sm":992,
"md":1200
},
"breakpoints":[
"xs",
"sm",
"md",
"lg"
],
"background_color":[
"",
"#12308b"
],
"background_horizontal_position":"center"
},
"pk":15056
},
[]
],
[
"BootstrapContainerPlugin",
{
"glossary":{
"media_queries":{
"xs":[
"(max-width: 768px)"
],
"lg":[
"(min-width: 1200px)"
],
"sm":[
"(min-width: 768px)",
"(max-width: 992px)"
],
"md":[
"(min-width: 992px)",
"(max-width: 1200px)"
]
},
"container_max_widths":{
"xs":750,
"lg":1170,
"sm":750,
"md":970
},
"fluid":"",
"breakpoints":[
"xs",
"sm",
"md",
"lg"
]
},
"pk":15057
},
[
[
"BootstrapRowPlugin",
{
"glossary":{
"extra_css_classes":[],
"hide_plugin":"",
"extra_inline_styles:Margins":{
"margin-top":"",
"margin-bottom":""
}
},
"pk":15058
},
[
[
"BootstrapColumnPlugin",
{
"glossary":{
"container_max_widths":{
"xs":720.0,
"lg":1140.0,
"sm":720.0,
"md":940.0
},
"xs-column-width":"col-xs-12"
},
"pk":15059
},
[
[
"CarouselPlugin",
{
"glossary":{
"resize_options":[
"upscale",
"crop",
"subject_location",
"high_resolution"
],
"container_max_heights":{
"xs":"100px",
"md":"200px",
"sm":"150px",
"lg":"250px"
},
"interval":"5",
"options":[
"slide",
"pause",
"wrap"
]
},
"pk":15060
},
[
[
"CarouselSlidePlugin",
{
"glossary":{
"resize_options":[
"upscale",
"crop",
"subject_location",
"high_resolution"
],
"image":{
"pk":170,
"model":"filer.Image"
},
"image_title":"",
"alt_tag":""
},
"pk":15061
},
[
[
"TextPlugin",
{
"body":"<h3>Django under the Hood</h3>\n\n<p>Conference ending</p>",
"pk":15062
},
[]
]
]
],
[
"CarouselSlidePlugin",
{
"glossary":{
"resize_options":[
"upscale",
"crop",
"subject_location",
"high_resolution"
],
"image":{
"pk":171,
"model":"filer.Image"
},
"image_title":"",
"alt_tag":""
},
"pk":15063
},
[
[
"TextPlugin",
{
"body":"<h1>Social Event</h1>\n\n<p>at <cms-plugin id=\"15065\" alt=\"Link - Pllek \" title=\"Link - Pllek\"></cms-plugin>, Amsterdam</p>",
"pk":15064
},
[
[
"TextLinkPlugin",
{
"glossary":{
"link_content":"Pllek",
"link":{
"url":"http://www.pllek.nl/",
"type":"exturl"
},
"target":"",
"title":""
},
"pk":15065
},
[]
]
]
]
]
],
[
"CarouselSlidePlugin",
{
"glossary":{
"resize_options":[
"upscale",
"crop",
"subject_location",
"high_resolution"
],
"image":{
"pk":172,
"model":"filer.Image"
},
"image_title":"",
"alt_tag":""
},
"pk":15066
},
[]
]
]
],
[
"ShopProductGallery",
{
"glossary":{
"hide_plugin":""
},
"pk":15067,
"inlines":[
{
"product":{
"pk":50
}
},
{
"product":{
"pk":25
}
},
{
"product":{
"pk":48
}
},
{
"product":{
"pk":22
}
},
{
"product":{
"pk":54
}
},
{
"product":{
"pk":51
}
},
{
"product":{
"pk":49
}
}
]
},
[]
]
]
]
]
],
[
"BootstrapRowPlugin",
{
"glossary":{
"extra_css_classes":[],
"hide_plugin":"",
"extra_inline_styles:Margins":{
"margin-top":"10px",
"margin-bottom":"20px"
}
},
"pk":15068
},
[
[
"BootstrapColumnPlugin",
{
"glossary":{
"container_max_widths":{
"xs":220.0,
"lg":360.0,
"sm":220.0,
"md":293.33
},
"xs-column-width":"col-xs-4"
},
"pk":15069
},
[
[
"FramedIconPlugin",
{
"glossary":{
"font_size":"10em",
"color":"#470a31",
"background_color":[
"",
"#c8ffcd"
],
"symbol":"heart-empty-2",
"hide_plugin":"",
"text_align":"text-center",
"icon_font":"4",
"border_radius":"50%",
"border":[
"3px",
"dotted",
"#000000"
]
},
"pk":15070
},
[]
]
]
],
[
"BootstrapColumnPlugin",
{
"glossary":{
"container_max_widths":{
"xs":220.0,
"lg":360.0,
"sm":220.0,
"md":293.33
},
"xs-column-width":"col-xs-4"
},
"pk":15071
},
[
[
"FramedIconPlugin",
{
"glossary":{
"font_size":"10em",
"color":"#470a31",
"background_color":[
"",
"#c8ffcd"
],
"symbol":"linux",
"hide_plugin":"",
"text_align":"text-center",
"icon_font":"4",
"border_radius":"50%",
"border":[
"3px",
"solid",
"#000000"
]
},
"pk":15072,
"shared_glossary":"HeadIcon"
},
[]
]
]
],
[
"BootstrapColumnPlugin",
{
"glossary":{
"container_max_widths":{
"xs":220.0,
"lg":360.0,
"sm":220.0,
"md":293.33
},
"xs-column-width":"col-xs-4"
},
"pk":15073
},
[
[
"FramedIconPlugin",
{
"glossary":{
"font_size":"10em",
"color":"#470a31",
"background_color":[
"",
"#c8ffcd"
],
"symbol":"windows",
"hide_plugin":"",
"text_align":"text-center",
"icon_font":"4",
"border_radius":"50%",
"border":[
"3px",
"solid",
"#000000"
]
},
"pk":15074,
"shared_glossary":"HeadIcon"
},
[]
]
]
]
]
],
[
"BootstrapRowPlugin",
{
"glossary":{
"extra_css_classes":[],
"hide_plugin":"",
"extra_inline_styles:Margins":{
"margin-top":"",
"margin-bottom":"30px"
}
},
"pk":15075
},
[
[
"BootstrapColumnPlugin",
{
"glossary":{
"sm-responsive-utils":"",
"xs-responsive-utils":"",
"md-column-offset":"",
"sm-column-width":"col-sm-6",
"md-responsive-utils":"",
"xs-column-offset":"",
"sm-column-offset":"",
"sm-column-ordering":"",
"md-column-ordering":"",
"lg-column-ordering":"",
"lg-column-offset":"",
"lg-column-width":"",
"xs-column-width":"col-xs-12",
"lg-responsive-utils":"",
"container_max_widths":{
"xs":720.0,
"lg":555.0,
"sm":345.0,
"md":455.0
},
"md-column-width":"",
"xs-column-ordering":""
},
"pk":15076
},
[
[
"BootstrapPanelPlugin",
{
"glossary":{
"heading_size":"",
"panel_type":"panel-warning",
"heading":"Panel Heading",
"hide_plugin":"",
"footer":"Panel Footer"
},
"pk":15077
},
[
[
"LeafletPlugin",
{
"glossary":{
"hide_plugin":"",
"map_position":{
"lat":47.944636605532914,
"lng":12.570934295654299,
"zoom":12
},
"render_template":"cascade/plugins/googlemap.html",
"map_height":"400px",
"map_width":"100%"
},
"pk":15078,
"inlines":[
{
"position":{
"lat":47.92554522341879,
"lng":12.618141174316406
},
"popup_text":null,
"title":"Marker",
"marker_width":"",
"marker_anchor":{
"top":"",
"left":""
}
}
]
},
[]
]
]
]
]
],
[
"BootstrapColumnPlugin",
{
"glossary":{
"sm-responsive-utils":"",
"xs-responsive-utils":"",
"md-column-offset":"",
"sm-column-width":"col-sm-6",
"md-responsive-utils":"",
"xs-column-offset":"",
"sm-column-offset":"",
"sm-column-ordering":"",
"md-column-ordering":"",
"lg-column-ordering":"",
"lg-column-offset":"",
"md-column-width":"",
"xs-column-width":"col-xs-12",
"lg-responsive-utils":"",
"container_max_widths":{
"xs":720.0,
"lg":555.0,
"sm":345.0,
"md":455.0
},
"lg-column-width":"",
"xs-column-ordering":""
},
"pk":15079
},
[
[
"BootstrapAccordionPlugin",
{
"glossary":{
"hide_plugin":"",
"close_others":"on",
"first_is_open":"on"
},
"pk":15080
},
[
[
"BootstrapAccordionPanelPlugin",
{
"glossary":{
"heading_size":"",
"panel_type":"panel-success",
"panel_title":"First"
},
"pk":15081
},
[
[
"TextPlugin",
{
"body":"<p>Nullam id dolor id nibh ultricies vehicula ut id elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. <cms-plugin id=\"15083\" alt=\"Link - Donec \" title=\"Link - Donec\"></cms-plugin> id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit sit amet non magna.</p>",
"pk":15082
},
[
[
"TextLinkPlugin",
{
"glossary":{
"link_content":"Donec",
"link":{
"pk":25,
"model":"cms.Page",
"type":"cmspage",
"section":""
},
"target":"",
"title":""
},
"pk":15083
},
[]
]
]
]
]
],
[
"BootstrapAccordionPanelPlugin",
{
"glossary":{
"heading_size":"",
"panel_type":"panel-success",
"panel_title":"Second"
},
"pk":15084
},
[
[
"BootstrapImagePlugin",
{
"glossary":{
"image_width_responsive":"",
"target":"",
"title":"",
"image":{
"pk":1,
"model":"filer.Image"
},
"alt_tag":"",
"image_width_fixed":"",
"image_height":"",
"link":{
"type":"none"
},
"resize_options":[
"upscale",
"crop",
"subject_location",
"high_resolution"
],
"image_title":"Django Pony",
"image_shapes":[
"img-responsive"
]
},
"pk":15085
},
[]
]
]
]
]
],
[
"BootstrapTabSetPlugin",
{
"glossary":{
"justified":"on"
},
"pk":15086
},
[
[
"BootstrapTabPanePlugin",
{
"glossary":{
"tab_title":"Left"
},
"pk":15087
},
[
[
"TextPlugin",
{
"body":"<h3>Vestibulum id ligula porta felis euismod semper</h3>\n\n<p><cms-plugin id=\"15091\" alt='Icon - fontawesome: <i class=\"icon-retweet\"></i> ' title='Icon - fontawesome: <i class=\"icon-retweet\"></i>'></cms-plugin>\u00a0Vestibulum <cms-plugin id=\"15092\" alt='Icon - fontawesome: <i class=\"icon-camera-alt\"></i> ' title='Icon - fontawesome: <i class=\"icon-camera-alt\"></i>'></cms-plugin>\u00a0id ligula porta felis euismod semper. <cms-plugin id=\"15089\" alt=\"Link - Nullam \" title=\"Link - Nullam\"></cms-plugin> id dolor id nibh ultricies vehicula ut id elit. <cms-plugin id=\"15090\" alt=\"Link - Cras \" title=\"Link - Cras\"></cms-plugin> mattis consectetur purus sit amet fermentum. <cms-plugin id=\"15093\" alt=\"Link - Donec \" title=\"Link - Donec\"></cms-plugin> sed odio dui. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.</p>",
"pk":15088
},
[
[
"TextLinkPlugin",
{
"glossary":{
"link_content":"Nullam",
"link":{
"pk":56,
"model":"myshop.Product",
"type":"product"
},
"target":"",
"title":""
},
"pk":15089
},
[]
],
[
"TextLinkPlugin",
{
"glossary":{
"link_content":"Cras",
"link":{
"pk":55,
"model":"myshop.Product",
"type":"product"
},
"target":"",
"title":""
},
"pk":15090
},
[]
],
[
"TextIconPlugin",
{
"glossary":{
"icon_font":"4",
"symbol":"retweet"
},
"pk":15091
},
[]
],
[
"TextIconPlugin",
{
"glossary":{
"icon_font":"4",
"symbol":"camera-alt"
},
"pk":15092
},
[]
],
[
"TextLinkPlugin",
{
"glossary":{
"link_content":"Donec",
"link":{
"pk":50,
"model":"myshop.Product",
"type":"product"
},
"target":"",
"title":""
},
"pk":15093
},
[]
]
]
],
[
"BootstrapButtonPlugin",
{
"glossary":{
"icon_align":"icon-right",
"symbol":"angle-circled-right",
"button_size":"btn-lg",
"quick_float":"",
"button_options":[],
"icon_font":"4",
"link_content":"Proceed",
"link":{
"pk":54,
"model":"myshop.Product",
"type":"product"
},
"button_type":"btn-info",
"hide_plugin":""
},
"pk":15094
},
[]
]
]
],
[
"BootstrapTabPanePlugin",
{
"glossary":{
"tab_title":"Right"
},
"pk":15095
},
[
[
"BootstrapSecondaryMenuPlugin",
{
"glossary":{
"page_id":"shop-order",
"hide_plugin":"",
"render_template":"cascade/bootstrap3/secmenu-list-group.html"
},
"pk":15096
},
[]
],
[
"HeadingPlugin",
{
"glossary":{
"content":"Heading with Anchor",
"element_id":"anchor1",
"tag_type":"h1",
"hide_plugin":"",
"extra_inline_styles:Margins":{
"margin-right":"",
"margin-top":"10px",
"margin-bottom":"10px",
"margin-left":""
}
},
"pk":15097
},
[]
]
]
]
]
]
]
]
]
]
]
]
]
}

View File

@@ -0,0 +1 @@
{% extends "weirdlittleempire/pages/error.html" %}

View File

@@ -0,0 +1 @@
{% extends "weirdlittleempire/pages/error.html" %}

View File

@@ -0,0 +1 @@
{% extends "weirdlittleempire/pages/error.html" %}

View File

@@ -0,0 +1 @@
{% extends "shop/cart/editable.html" %}

View File

@@ -0,0 +1,12 @@
{% extends "shop/catalog/available-product-add2cart.html" %}
{% load i18n %}
{% block available-quantity-in-stock %}{# intentionally empty #}{% endblock %}
{% block change-purchasing-quantity %}
<div class="d-flex flex-column w-25" ng-hide="context.availability.quantity">
<div class="lead mt-1">
{% trans "This item has already been sold" %}
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,23 @@
{% extends "weirdlittleempire/pages/default.html" %}
{% load cms_tags sekizai_tags sass_tags %}
{% block title %}{{ product.product_name }}{% endblock %}
{% block breadcrumb %}{% with extra_ance=product.product_name %}
{% if product.show_breadcrumb %}{% include "shop/breadcrumb/default.html" %}{% endif %}
{% endwith %}{% endblock %}
{% block main-content %}
{# the first `render_placeholder` is only required for editing the page #}
{% render_placeholder product.placeholder %}{% render_placeholder product.placeholder as product_details %}
{% if not product_details %}
<div class="container">
<div class="row">
<div class="col">
<h1>{% render_model product "product_name" %}</h1>
<p class="lead">Edit this page, then switch into <em>Structure</em> mode and add plugins to placeholder <code> {{ product.placeholder.slot }} </code>.</p>
</div>
</div>
</div>
{% endif %}
{% endblock main-content %}

View File

@@ -0,0 +1,9 @@
{% load static sekizai_tags %}
{% addtoblock "js" %}<script src="{% static 'shop/js/filter-form.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% add_data "ng-requires" "django.shop.filter" %}
<form shop-product-filter="manufacturer" style="margin-bottom: 10px;">
{{ filter.filter_set.form.as_div }}
</form>

View File

@@ -0,0 +1,23 @@
{% extends "weirdlittleempire/pages/default.html" %}
{% load cms_tags sekizai_tags sass_tags %}
{% block title %}{{ product.product_name }}{% endblock %}
{% block breadcrumb %}{% with extra_ance=product.product_name %}
{% include "shop/breadcrumb/default.html" %}
{% endwith %}{% endblock %}
{% block main-content %}
<div class="container">
<div class="row">
<div class="col">
<h1>{% render_model product "product_name" %}</h1>
{# the first `render_placeholder` is only required for editing the page #}
{% render_placeholder product.placeholder %}{% render_placeholder product.placeholder as product_details %}
{% if not product_details %}
<p class="lead">Edit this page, then switch into <em>Structure</em> mode and add plugins to placeholder <code> {{ product.placeholder.slot }} </code>.</p>
{% endif %}
</div>
</div>
</div>
{% endblock main-content %}

View File

@@ -0,0 +1,36 @@
{% extends "weirdlittleempire/catalog/product-detail.html" %}
{% load i18n cms_tags thumbnail %}
{% block main-content %}
{% thumbnail product.images.first 250x250 crop as thumb %}
<div class="container">
<div class="row">
<div class="col col-md-10 offset-md-1">
<h1>{% render_model product "product_name" %}</h1>
<div class="media mb-3 flex-column flex-md-row">
<img class="mr-3 mb-3" src="{{ thumb.url }}" width="{{ thumb.width }}" height="{{ thumb.height }}" alt="{{ product.product_name }}">
<div class="media-body">
{{ product.description|safe }}
</div>
</div>
<h4>{% trans "Details" %}</h4>
<ul class="list-group mb-3">
<li class="list-group-item d-flex">
<div class="w-50">{% trans "Card Type" %}:</div>
<strong>{{ product.get_card_type_display }}</strong>
</li>
<li class="list-group-item d-flex">
<div class="w-50">{% trans "Storage capacity" %}:</div>
<strong>{{ product.storage }} GB</strong>
</li>
<li class="list-group-item d-flex">
<div class="w-50">{% trans "Manufacturer" %}:</div>
<strong>{{ product.manufacturer }}</strong>
</li>
</ul>
<!-- include "Add to Cart" dialog box -->
{% include "shop/catalog/available-product-add2cart.html" with card_css_classes="mb-3" %}
</div>
</div>
</div>
{% endblock main-content %}

View File

@@ -0,0 +1,18 @@
{% extends "shop/catalog/available-product-add2cart.html" %}
{% load i18n %}
{% block add-to-cart-url %}{{ product.get_absolute_url }}/add-smartphone-to-cart{% endblock %}
{% block available-quantity-in-stock %}
<div class="d-flex flex-column">
<label for="product_code">{% trans "Internal Storage" %}</label>
<select class="form-control" name="product_code" ng-model="context.product_code" ng-change="updateContext()" >
{% for smartphone in product.variants.all %}
<option value="{{ smartphone.product_code }}">
{% if smartphone.storage == 0 %}{% trans "Pluggable" %}{% else %}{{ smartphone.storage }} GB{% endif %}
</option>
{% endfor %}
</select>
</div>
{{ block.super }}
{% endblock %}

View File

@@ -0,0 +1,71 @@
{% extends "weirdlittleempire/catalog/product-detail.html" %}
{% load i18n static cms_tags sekizai_tags sass_tags %}
{% block main-content %}
{% addtoblock "css" %}<link href="{% sass_src 'shop/css/bsp-scrollpanel.scss' %}" rel="stylesheet" type="text/css" />{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'node_modules/angular-bootstrap-plus/src/scrollpanel/scrollpanel.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% add_data "ng-requires" "bs-plus.scrollpanel" %}
<div class="container">
<div class="row">
<div class="col col-md-10 offset-md-1">
<h1>{% render_model product "product_name" %}</h1>
<bsp-scrollpanel class="shop-product-detail">
<ul>{% for img in product.images.all %}
<li><img src="{{ img.url }}" alt="{{ product.product_name }}" /></li>
{% endfor %}</ul>
</bsp-scrollpanel>
</div>
<div class="col col-md-10 offset-md-1">
<h4>{% trans "Details" %}</h4>
{{ product.description|safe }}
<ul class="list-group mb-3">
<li class="list-group-item d-flex">
<div class="w-50">{% trans "Manufacturer" %}:</div>
<strong>{{ product.manufacturer }}</strong>
</li>
<li class="list-group-item d-flex">
<div class="w-50">{% trans "Battery" %}:</div>
<strong>{{ product.get_battery_type_display }} ({{ product.battery_capacity }} mAh)</strong>
</li>
<li class="list-group-item d-flex">
<div class="w-50">{% trans "RAM Storage" %}:</div>
<strong>{{ product.ram_storage }} MB</strong>
</li>
<li class="list-group-item d-flex">
<div class="w-50">{% trans "WiFi Connectivity" %}:</div>
<strong>{{ product.wifi_connectivity }}</strong>
</li>
<li class="list-group-item d-flex">
<div class="w-50">Bluetooth:</div>
<strong>{{ product.get_bluetooth_display }}</strong>
</li>
<li class="list-group-item d-flex">
<div class="w-50">GPS:</div>
<strong><i class="fa {{ product.gps|yesno:'fa-check,fa-times' }}"></i></strong>
</li>
<li class="list-group-item d-flex">
<div class="w-50">{% trans "Dimensions" %}:</div>
<strong>{{ product.width }} mm (w) &times; {{ product.height }} mm (h)</strong>
</li>
<li class="list-group-item d-flex">
<div class="w-50">{% trans "Weight" %}:</div>
<strong>{{ product.weight }} g</strong>
</li>
<li class="list-group-item d-flex">
<div class="w-50">{% trans "Screen size" %}:</div>
<strong>{{ product.screen_size }} ({% trans "inch" %})</strong>
</li>
</ul>
<!-- include "Add to Cart" dialog box -->
{% include "weirdlittleempire/catalog/smartphone-add2cart.html" with use_modal_dialog=True card_css_classes="mb-3" %}
</div>
</div>
</div>
{% include "shop/catalog/bsp-scrollpanel.tmpl.html" %}
{% endblock main-content %}

View File

@@ -0,0 +1,6 @@
{% extends "shop/email/base.html" %}
{% load post_office %}
{% block email-logo %}
<img src="{% inline_image 'weirdlittleempire/django-shop-logo.png' %}" width="200" style="margin: 20px auto; display: block;" />
{% endblock %}

View File

@@ -0,0 +1,6 @@
{% extends "shop/email/password-reset-body.html" %}
{% load post_office %}
{% block email-logo %}
<img src="{% inline_image 'weirdlittleempire/django-shop-logo.png' %}" width="200" style="margin: 20px auto; display: block;" />
{% endblock %}

View File

@@ -0,0 +1,6 @@
{% extends "shop/email/register-user-body.html" %}
{% load post_office %}
{% block email-logo %}
<img src="{% inline_image 'weirdlittleempire/django-shop-logo.png' %}" width="200" style="margin: 20px auto; display: block;" />
{% endblock %}

View File

@@ -0,0 +1,67 @@
{% load static cms_tags sekizai_tags djng_tags i18n %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}" ng-app="myShop">
<head>
<title>{% block title %}django SHOP demo{% endblock %}</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="{{ ROBOTS_META_TAGS }}" />
<meta name="description" content="{% block meta-description %}{% endblock %}" />
{% block head %}{% endblock head %}
{% render_block "css" postprocessor "compressor.contrib.sekizai.compress" %}
</head>
{% addtoblock "js" %}<script src="{% static 'node_modules/angular/angular.min.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'node_modules/angular-sanitize/angular-sanitize.min.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'node_modules/angular-i18n/' %}{% djng_locale_script 'de' %}" type="text/javascript"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'node_modules/angular-animate/angular-animate.min.js' %}" type="text/javascript"></script>{% endaddtoblock %}
<body>
{% cms_toolbar %}
<header>
{% block header %}{% endblock %}
</header>
{% block toast-messages %}{% include "shop/messages.html" %}{% endblock %}
<main>
{% block breadcrumb %}{% endblock %}
{% block main-content %}
<div class="container">
<div class="row shop-starter-template">
<div class="col">
<h1>Base Template</h1>
<p class="lead">This document does not contain any content yet.</p>
</div>
</div>
</div>
{% endblock main-content %}
</main>
<footer class="footer">
{% block footer %}{% endblock footer %}
</footer>
{% render_block "js" postprocessor "compressor.contrib.sekizai.compress" %}
<script type="text/javascript">
angular.module('myShop', ['ngAnimate', 'ngSanitize', {% with_data "ng-requires" as ng_requires %}
{% for module in ng_requires %}'{{ module }}'{% if not forloop.last %}, {% endif %}{% endfor %}{% end_with_data %}
]).config(['$httpProvider', '$locationProvider', '$sanitizeProvider', function($httpProvider, $locationProvider, $sanitizeProvider) {
$httpProvider.defaults.headers.common['X-CSRFToken'] = '{{ csrf_token }}';
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
$locationProvider.html5Mode({
enabled: true,
requireBase: false,
rewriteLinks: false
});
$sanitizeProvider.addValidAttrs(['srcset']);
}]){% with_data "ng-config" as configs %}
{% for config in configs %}.config({{ config }}){% endfor %};
{% end_with_data %}
</script>
</body>
</html>

View File

@@ -0,0 +1,36 @@
{% extends "weirdlittleempire/pages/base.html" %}
{% load static cms_tags i18n sekizai_tags sass_tags %}
{% block title %}{% page_attribute "page_title" %}{% endblock %}
{% block head %}
{{ block.super }}
{% addtoblock "css" %}<link href="{% sass_src 'weirdlittleempire/css/default.scss' %}" rel="stylesheet" type="text/css" />{% endaddtoblock %}
{% endblock head %}
{% block header %}
{% include "weirdlittleempire/pages/navbar.html" with navbar_classes="navbar-expand-lg navbar-light bg-light fixed-top" %}
{% endblock header %}
{% block breadcrumb %}
{% placeholder "Breadcrumb" %}
{% endblock breadcrumb %}
{% block main-content %}{% placeholder "Main Content" inherit or %}
<div class="container">
<div class="row shop-starter-template">
<div class="col">
<h1>Default Template</h1>
<p class="lead">Use this placeholder as a quick way to start editing a new CMS page.<br/>
All you have to do is to append <code>?edit</code> to the URL and switch to “Structure” mode.</p>
</div>
</div>
</div>
{% endplaceholder %}{% endblock main-content %}
{% block footer %}{% static_placeholder "Static Footer" or %}
<div class="container">
<p class="text-muted">Place sticky footer content here.</p>
</div>
{% endstatic_placeholder %}{% endblock footer %}

View File

@@ -0,0 +1,19 @@
{% extends "weirdlittleempire/pages/default.html" %}%}
{% load i18n cms_tags %}
{% block breadcrumb %}{% endblock %}
{% page_url 'shop-login' as login_url %}
{% block main-content %}
<div class="container mt-5">
<div class="row">
<div class="col col-sm-10 col-md-8 offset-sm-1 offset-md-2">
<h3>{{ detail|default:"Forbidden" }}</h3>
{% if status_code == 403 and login_url %}
<p>{% blocktrans %}In case you have ordered anything on this site before, please <a href="{{ login_url }}">sign in</a> and try again.{% endblocktrans %}</p>
{% endif %}
</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,49 @@
{% extends "bootstrap4/includes/ng-nav-navbar.html" %}
{% load static i18n cms_tags menu_tags sekizai_tags sass_tags shop_tags %}
{% spaceless %}
{% page_url 'shop-watch-list' as shop_watch_list_url %}{% if not shop_watch_list_url %}{% url "shop-watch-list" as shop_watch_list_url %}{% endif %}
{% block navbar %}
<div class="container">
{% block navbar-brand %}
<div class="shop-brand-icon">
<a href="/">
<img src="{% static 'weirdlittleempire/django-shop-logo.svg' %}" alt="django-SHOP" aria-hidden="true">
</a>
</div>
{% endblock %}
{% block navbar-toggler %}{{ block.super }}{% endblock %}
<div class="collapse navbar-collapse" uib-collapse="isNavCollapsed">
<ul class="navbar-nav flex-wrap align-content-between w-100">
<li class="nav-item shop-social-icons">{% static_placeholder "Social Icons" %}</li>
<li class="mx-auto"></li>
{% include "shop/navbar/login-logout.html" with item_class="shop-secondary-menu" %}
{% with item_class="shop-secondary-menu" %}{% language_chooser "shop/navbar/language-chooser.html" %}{% endwith %}
{% include "shop/navbar/watch-icon.html" with item_class="shop-secondary-menu" %}
{% with item_class="shop-secondary-menu" %}
{% if current_page.reverse_id == 'shop-cart' or current_page.reverse_id == 'shop-watch-list' %}
{% cart_icon without %}
{% else %}
{% cart_icon unsorted %}
{% endif %}
{% endwith %}
<li class="w-100"></li>
{% with item_class="nav-item shop-primary-menu" %}{% block navbar-nav %}{{ block.super }}{% endblock %}{% endwith %}
<li class="nav-item shop-search-form">{% include "shop/navbar/search-form.html" with search_form_classes="form-inline" %}</li>
</ul>
</div>
</div>
{% addtoblock "js" %}<script src="{% static 'node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% add_data "ng-requires" "ui.bootstrap" %}
{% addtoblock "js" %}<script src="{% static 'cms_bootstrap/js/ng-nav-navbar.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'shop/js/navbar.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% add_data "ng-requires" "django.shop.navbar" %}
{% endblock navbar %}
{% endspaceless %}

View File

@@ -0,0 +1,54 @@
{% load static i18n cascade_tags djng_tags sekizai_tags sass_tags %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}" ng-app="myShop">
<head>
<title>Test page</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="{{ ROBOTS_META_TAGS }}" />
<meta name="description" content="{% block meta-description %}{% endblock %}" />
{% block head %}{% endblock head %}
{% render_block "css" postprocessor "shop.sekizai_processors.compress" %}
</head>
{% addtoblock "css" %}<link href="{% sass_src 'weirdlittleempire/css/default.scss' %}" rel="stylesheet" type="text/css" />{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'node_modules/angular/angular.min.js' %}" type="text/javascript"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'node_modules/angular-sanitize/angular-sanitize.min.js' %}"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'node_modules/angular-i18n/' %}{% djng_locale_script 'de' %}"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script src="{% static 'node_modules/angular-animate/angular-animate.min.js' %}"></script>{% endaddtoblock %}
<body>
<header>
{% include "weirdlittleempire/pages/navbar.html" with navbar_classes="navbar-default navbar-fixed-top" %}
</header>
<main>
{% render_cascade "weirdlittleempire/strides/home.json" %}
</main>
<footer class="footer">
{% block footer %}{% endblock footer %}
</footer>
{% render_block "js" postprocessor "shop.sekizai_processors.compress" %}
<script type="text/javascript">
angular.module('myShop', ['ngAnimate', 'ngSanitize', {% with_data "ng-requires" as ng_requires %}
{% for module in ng_requires %}'{{ module }}'{% if not forloop.last %}, {% endif %}{% endfor %}{% end_with_data %}
]).config(['$httpProvider', '$locationProvider', function($httpProvider, $locationProvider) {
$httpProvider.defaults.headers.common['X-CSRFToken'] = '{{ csrf_token }}';
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
$locationProvider.html5Mode({
enabled: true,
requireBase: false,
rewriteLinks: false
});
}]){% with_data "ng-config" as configs %}
{% for config in configs %}.config({{ config }}){% endfor %};
{% end_with_data %}
</script>
</body>
</html>

View File

@@ -0,0 +1,6 @@
{% extends "shop/print/delivery-note.html" %}
{% load static %}
{% block header %}
<img src="{% static 'weirdlittleempire/django-shop-logo.svg' %}" class="shop-logo" alt="django-SHOP" height="45">
{% endblock %}

View File

@@ -0,0 +1,6 @@
{% extends "shop/print/invoice.html" %}
{% load static %}
{% block header %}
<img src="{% static 'weirdlittleempire/django-shop-logo.svg' %}" class="shop-logo" alt="django-SHOP" height="45">
{% endblock %}

View File

@@ -0,0 +1,2 @@
{% extends "shop/products/cart-product-media.html" %}
{% block sample-image %}{% include "shop/products/sample-image.html" %}{% endblock %}

View File

@@ -0,0 +1,4 @@
{% load thumbnail %}
{% thumbnail product.sample_image 244x244 crop as thumb %}
{% thumbnail product.sample_image 488x488 crop as thumb2 %}
<img class="img-fluid" src="{{ thumb.url }}" width="{{ thumb.width }}" height="{{ thumb.height }}" srcset="{{ thumb.url }} 1x, {{ thumb2.url }} 2x" />

View File

@@ -0,0 +1,7 @@
{% extends "shop/products/dropdown-product-media.html" %}
{% load thumbnail %}
{% block sample-image %}
{% thumbnail product.sample_image 50x50 crop as thumb %}
{% thumbnail product.sample_image 100x100 crop as thumb2 %}
<img class="mr-1" width="{{ thumb.width }}" height="{{ thumb.height }}" src="{{ thumb.url }}" srcset="{{ thumb.url }} 1x, {{ thumb2.url }} 2x" />
{% endblock %}

View File

@@ -0,0 +1 @@
{% extends "shop/products/sample-image.path" %}

View File

@@ -0,0 +1,2 @@
{% extends "shop/products/order-product-media.html" %}
{% block sample-image %}{% include "shop/products/sample-image.html" %}{% endblock %}

View File

@@ -0,0 +1,2 @@
{% extends "shop/products/print-product-media.html" %}
{% block print-image %}{% include "shop/products/print-image.html" %}{% endblock %}

View File

@@ -0,0 +1,2 @@
{% extends "shop/products/search-product-media.html" %}
{% block sample-image %}{% include "shop/products/sample-image.html" %}{% endblock %}

View File

@@ -0,0 +1,5 @@
{% extends "weirdlittleempire/products/search-product-media.html" %}
{% block media-body %}
<h4 class="media-heading"><a href="{{ product.get_absolute_url }}">{{ product.product_name }}</a></h4>
{{ product.description|truncatewords_html:50 }}
{% endblock %}

Some files were not shown because too many files have changed in this diff Show More