{ "info": { "author": "genkosta", "author_email": "genkosta43@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7" ], "description": "django-discounts-cart\n=====================\n\n\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f Django - \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043a\u0438\u0434\u043a\u0430\u043c\u0438 \u0438 \u043a\u043e\u0440\u0437\u0438\u043d\u043e\u0439 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\n\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0435.\n\nversion 1.1.7\n\nDjango >= 1.7 \u0438 Python 2.7\n\n\u0421\u043a\u0438\u0434\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0430\u0434\u043c\u0438\u043d-\u043f\u0430\u043d\u0435\u043b\u044c.\n\n\u0421\u043a\u0438\u0434\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442.\n\n\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u043a\u0438\u0434\u043e\u043a.\n\n\n\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430:\n~~~~~~~~~~\n\n::\n\n 1) pip install django-discounts-cart\n\n 2) \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 INSTALLED_APPS\n 'discounts_cart',\n\n 3) \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 context_processors\n 'discounts_cart.context_processors.vars_cart',\n\n 4) \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 discounts-cart \u0432 urls.py \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430\n url(r'^cart/', include('discounts_cart.urls', namespace='discounts_cart')),\n\n 5) \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\n jquery.cookie.js --> http://plugins.jquery.com/cookie/\n cart.js --> https://github.com/genkosta/django-discounts-cart/blob/master/cart.js\n templates/discounts_cart/in_cart_link.html --> https://github.com/genkosta/django-discounts-cart/tree/master/templates/discounts_cart\n\n 6) \u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438\n python manage.py migrate discounts_cart\n\n\n\u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0442\u043e\u0432\u0430\u0440\u0430, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u0438\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c __init__.py \u0438 apps.py\n \u041f\u0440\u0438\u043c\u0435\u0440:\n __init__.py\n default_app_config = 'products.apps.ProductsConfig'\n \n apps.py\n from django.apps import AppConfig\n \n class ProductsConfig(AppConfig):\n name = 'products'\n verbose_name = 'Products'\n\n\n \u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439:\n ( \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c --> https://github.com/genkosta/django-discounts-cart/tree/master/examples )\n\n from django.db import models\n from discounts_cart.models import DiscountsInCategories, DiscountsInProducts\n\n class Brand(DiscountsInCategories):\n pass\n\n class Category(DiscountsInCategories):\n pass\n\n class Parameter(DiscountsInCategories):\n pass\n\n # Product - \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u0432\u043e \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0442\u043e\u0432\u0430\u0440\u043e\u0432\n class Product(DiscountsInProducts):\n brand = models.ForeignKey(Brand)\n categories = models.ManyToManyField(Category)\n parameters = models.ManyToManyField(Parameter)\n \n # \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434\n def view_price(self):\n pattern = re.compile(r'\\.[0]+$')\n return '{0} {1}'.format(pattern.sub('', str(self.price)), self.currency)\n view_price.short_description = _('Price')\n\n # \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434\n @property\n def get_correct_price(self):\n return self.price # Only Decimal type\n\n # Add names of fields to calculate discounts\n # \u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434\n @staticmethod\n def get_field_names():\n field_names_dect = {\n 'foreign_key': ('brand',),\n 'many_to_many': ('categories', 'parameters')\n }\n return field_names_dect\n\n\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u044b\n~~~~~~~~~~~~~~~~~~~\n\nbase.html\n^^^^^^^^^\n\n::\n\n \n
\n Product: {{ product.name }}
\n Discount {{ product.view_optimal_discount }}
\n Price: {{ product.view_price }} < > {{ product.view_optimal_price }} {{ product.currency }}\n
\n Product: {{ product.name }}
\n Count: {{ product.count }}
\n Price: {{ product.view_optimal_price }} {{ product.currency }}\n
_ _ _ _ _ _ _ _ _ _
\n \n \n\u0418\u0442\u043e\u0433\u043e
\nTotal count: {{ cart_count }}
\nTotal amount: {{ cart_amount }}
\n {% if cart_count %}\n \n_ _ _ _ _ _ _ _ _ _
\n \n \n\u041f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441 \u043f\u0440\u043e\u043c\u043e-\u043a\u043e\u0434\u043e\u043c
\nTotal count: 0
\nTotal amount: 0
\n \n \n_ _ _ _ _ _ _ _ _ _
\n \n \n\u041f\u043b\u0430\u0442\u0435\u0436
\n \n {% endif %}\n {% endblock %}\n\n\u0414\u043b\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043a\u0438\u0434\u043a\u0430\u043c\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n \u041f\u0440\u0438\u043c\u0435\u0440:\n \n home views.py\n \n from products.models import Product # \u0438\u043b\u0438 Phone \u0438\u043b\u0438 \u0421\u0442\u0438\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0448\u0438\u043d\u044b\n \n def home(request):\n \n if request.GET.get('sort_by_optimal_discount', False):\n # \u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u0432\u0441\u0435\u0445 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445, \u043f\u043b\u044e\u0441 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043a\u0438\u0434\u043a\u0430\u043c\n products = Product.products.sort_by_optimal_discount()\n else:\n # \u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u0432\u0441\u0435\u0445 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445\n products = Product.products.active()\n # \u0438\u043b\u0438\n # products = Product.objects.filter(active=True)\n \n return render(request, 'home.html', {\n 'products': products\n })\n\n\u0414\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043d\u0430\u0434 \u0441\u043a\u0438\u0434\u043a\u0430\u043c\u0438, \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043e\u043f\u043b\u0430\u0442\u044b, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n( \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u043c\u043e-\u043a\u043e\u0434\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043a\u0430\u043a \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0435, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0443\u0434\u0430\u043b\u044f\u0442\u0441\u044f. )\n\n::\n\n \u041f\u0440\u0438\u043c\u0435\u0440:\n \n payment views.py\n \n from discounts_cart.utils import control_promo_codes, recalculation_payment\n\n def payment(request):\n\n if request.method == 'POST':\n \n # Recalculation before payment ( for checking )\n result = recalculation_payment(request)\n count_products = result['count']\n amount = result['amount']\n \n # Control promo-codes\n promo_code = request.POST['promo_code'].strip()\n control_promo_codes(request, promo_code)\n\nCron\n~~~~\n\n( \u041f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u044b \u0432 Cron. )\n\n::\n\n # \u0414\u0435\u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043a\u0438\u0434\u043a\u0438\n python manage.py discounts_cart deact\n \u0438\u043b\u0438\n # \u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043a\u0438\u0434\u043a\u0438\n python manage.py discounts_cart del", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/genkosta/django-discounts-cart/tarball/master", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/genkosta/django-discounts-cart", "keywords": "django discounts cart commerce e-ecommerce", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "django-discounts-cart", "package_url": "https://pypi.org/project/django-discounts-cart/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-discounts-cart/", "project_urls": { "Download": "https://github.com/genkosta/django-discounts-cart/tarball/master", "Homepage": "https://github.com/genkosta/django-discounts-cart" }, "release_url": "https://pypi.org/project/django-discounts-cart/1.1.7/", "requires_dist": null, "requires_python": "", "summary": "Discounts for online store and management cart", "version": "1.1.7" }, "last_serial": 2501765, "releases": { "1.1.6": [ { "comment_text": "", "digests": { "md5": "056972131098675ef9679143751c2f25", "sha256": "eaaf27135cf02ce7f98b02109f03bc11d2522c09c1dc6068e6b4a48adef75967" }, "downloads": -1, "filename": "django-discounts-cart-1.1.6.tar.gz", "has_sig": false, "md5_digest": "056972131098675ef9679143751c2f25", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15263, "upload_time": "2016-09-28T17:09:34", "url": "https://files.pythonhosted.org/packages/52/55/1cce8c8649d3ac74dfa8eecdaab86385252222124a454c36ed1b71d5bb56/django-discounts-cart-1.1.6.tar.gz" } ], "1.1.7": [ { "comment_text": "", "digests": { "md5": "3a4174a25c0d796f905dc09189f9f014", "sha256": "48f29b470ed3cfa1f8bf1cb78fb839e127d898abb1900b2bea2137b575631418" }, "downloads": -1, "filename": "django-discounts-cart-1.1.7.tar.gz", "has_sig": false, "md5_digest": "3a4174a25c0d796f905dc09189f9f014", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17395, "upload_time": "2016-12-06T06:06:51", "url": "https://files.pythonhosted.org/packages/9e/dc/45c7192d02f7c16fdb0b2b8c97823d42b27f386351acc56c9bec465f0600/django-discounts-cart-1.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3a4174a25c0d796f905dc09189f9f014", "sha256": "48f29b470ed3cfa1f8bf1cb78fb839e127d898abb1900b2bea2137b575631418" }, "downloads": -1, "filename": "django-discounts-cart-1.1.7.tar.gz", "has_sig": false, "md5_digest": "3a4174a25c0d796f905dc09189f9f014", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17395, "upload_time": "2016-12-06T06:06:51", "url": "https://files.pythonhosted.org/packages/9e/dc/45c7192d02f7c16fdb0b2b8c97823d42b27f386351acc56c9bec465f0600/django-discounts-cart-1.1.7.tar.gz" } ] }