标签: django-oscar

没有任何东西出现在URL"http:// localhost:8000/buy /"

我想在我的网站上添加一个电子商务门户网站,我已经完成了Django-Oscar文档中给出的"创建你的商店页面"所提供的所有内容,只是在 urls.py而不是

url(r'', include(application.urls)),
Run Code Online (Sandbox Code Playgroud)

我已经添加了

url(r'^buy/', include(application.urls)),
Run Code Online (Sandbox Code Playgroud)

但问题是,当我点击网址时,它既没有显示任何内容也没有出错.

知道可能是什么问题吗?

它可能是一些网址冲突或其他一些微不足道但我无法理解从哪里开始调试.

文件urls.py

from django.conf.urls import patterns, include, url
from django.contrib import admin
from view import AboutusView, TwentySevenView
import apps.users.views
from django.conf import settings

    #oscar urls
    from oscar.app import application

    admin.site.site_header = ''
    urlpatterns = patterns('',
                           # Examples:
                           # url(r'^$', 'torquehp.views.home', name='home'),
                           # url(r'^users/', include('users.urls')),
                           url(r'^i18n/', include('django.conf.urls.i18n')),
                           url(r'^admin/', include(admin.site.urls)),
                           url(r'^about-us/$', AboutusView.as_view(), name="about-us"),
                           url(r'^24x7/$', TwentySevenView.as_view(), name="24x7"),
                           url(r'^$', apps.users.views.user_home, name="home"),
                           url(r'^markdown/', include('django_markdown.urls')),
                           url(r'^users/', include('apps.users.urls')),
                           url(r'^doorstep/', include('apps.doorstep.urls')),
                           url(r'^cars/', include('apps.cars.urls')), …
Run Code Online (Sandbox Code Playgroud)

django python-2.7 django-oscar

6
推荐指数
1
解决办法
2061
查看次数

如何将 Stripe 支付网关与 Django Oscar 集成?

我正在尝试将 Stripe 支付网关集成到 Django oscar,用于在线销售杂货等实物商品的电子商务网站。我使用 python 3.6.3、Django 2.0、Django-oscar 1.6、stripe 1.82.2。

方法一

所以我在 django-oscar 组中点击了这个链接:

https://groups.google.com/forum/#!searchin/django-oscar/handle_payment$20override%7Csort:date/django-oscar/Cr8sBI0GBu0/PHRdXX2uFQAJ

我已经注册了一个 Stripe 帐户并使用我的可发布密钥和测试密钥来配置 Stripe。问题是,当我尝试使用带有“Pay with Card”标签的按钮付款时,它会收集我的卡信息,然后当我单击按钮,它显示“一些钱将从卡中扣除”,如下图所示:预览页面的图像

然后在我点击下订单按钮后,它向我显示: 确认页面的图像

虽然我已经用我的卡付款了。我猜 oscar 似乎不知道付款已经通过 Stripe 完成了?但我不知道如何解决这个问题。

方法 2:我尝试使用 dj-stripe,在这里找到:

https://github.com/dj-stripe/dj-stripe

但是我在https://dj-stripe.readthedocs.io/en/stable-1.0/上阅读了整个文档 ,似乎我只能将它用于需要订阅的产品,我的不需要订阅和文档dj-stripe 不完整。

我尝试使用官方 django-oscar 存储库,链接在这里:https : //github.com/django-oscar/django-oscar-stripe,这个存储库已经有五年历史了,我认为它不兼容与我的 Django oscar 版本一起使用。

方法 3:我尝试使用 stripe.js 和元素并创建我的表单来接受卡片:

< script src = "https://js.stripe.com/v3/" > < /script> <
  script >
  var stripe = Stripe('your_stripe_publishable_key');
var elements = stripe.elements();
// Custom styling can be …
Run Code Online (Sandbox Code Playgroud)

python django stripe-payments django-oscar stripe.js

6
推荐指数
1
解决办法
4754
查看次数

Django-Oscar 覆盖模板标签

我试图通过使用具有 category_tags.py 文件(也是 init.py)的本地 templatetags 文件夹创建目录应用程序的本地版本来覆盖 category_tags。似乎使用了默认的 category_tags 文件。如果我更改了本地标签文件的名称,当然我在模板中加载了标签的新名称,但我想覆盖或扩展默认的 category_tags 而不是创建另一个。

有任何想法吗?

谢谢!

django overriding templatetags django-oscar

5
推荐指数
1
解决办法
1593
查看次数

OSCAR_SEARCH_FACETS用于过滤产品列表

我正在使用django oscar开发电子商务网站.产品已列出,我必须应用过滤器(例如年份,价格等).我们可以使用oscar facet来实现这种过滤功能吗?

我尝试按照oscar文档添加以下内容,但不知道如何使其工作并在我的前端渲染.

OSCAR_SEARCH_FACETS = {
'fields': OrderedDict([
    ('product_class', {'name': _('Type'), 'field': 'product_class'}),
    ('rating', {'name': _('Rating'), 'field': 'rating'}),
]),
'queries': OrderedDict([
    ('price_range',
     {
         'name': _('Price range'),
         'field': 'price',
         'queries': [
             # This is a list of (name, query) tuples where the name will
             # be displayed on the front-end.
             (_('0 to 20'), u'[0 TO 20]'),
             (_('20 to 40'), u'[20 TO 40]'),
             (_('40 to 60'), u'[40 TO 60]'),
             (_('60+'), u'[60 TO *]'),
         ]
     }),
])
} …
Run Code Online (Sandbox Code Playgroud)

python django django-oscar

5
推荐指数
1
解决办法
1350
查看次数

限制仪表板用户 Django-Oscar(沙盒网关应用程序)

如何限制仪表板用户?我已经安装了沙盒站点附带的网关应用程序,但据我所知,用户只是自动获得了仪表板访问权限。显然,这是一个安全问题。我已经阻止未经身份验证的用户查看网站的某些部分,但我需要能够限制/批准对仪表板的访问。

在我看来,我必须编写一个自定义视图/表单才能从仪表板执行此操作,并拥有待处理的帐户注册提要。

任何指针将不胜感激。

相关代码:

import logging

from django.views import generic
from django.contrib.auth.models import User
from django.contrib import messages
from django.core.mail import send_mail
from django import http
from django.core.urlresolvers import reverse
from django.template.loader import get_template
from django.template import Context

from apps.gateway import forms
from oscar.apps.customer.forms import generate_username

logger = logging.getLogger('gateway')


class GatewayView(generic.FormView):
    template_name = 'gateway/form.html'
    form_class = forms.GatewayForm

    def form_valid(self, form):
        real_email = form.cleaned_data['email']
        username = generate_username()
        password = generate_username()
        email = 'dashboard-user-%s@oscarcommerce.com' % username

        user = self.create_dashboard_user(username, email, password)
        self.send_confirmation_email(real_email, …
Run Code Online (Sandbox Code Playgroud)

python django django-oscar

5
推荐指数
1
解决办法
581
查看次数

如何仅索引那些模型\行,其中 some_field=some_value ?

我使用 django-oscar + Solr + haystack。

*===============================================================================================================*
|   id  | partner_sku|price_currency|price_excl_tax|num_in_stock|date_created|date_updated|partner_id|product_id|
|"10451"|"S0010436"  |  "USD"       |   74.00      |    20      |'some_date' |'some_date' |     1    | 5992     |
|"10452"|"S0010436"  |  "USD"       |   80.00      |     0      |'some_date' |'some_date' |     2    | 5992     |
*===============================================================================================================*
Run Code Online (Sandbox Code Playgroud)

我只想索引那些 所在的行partner_id=2index_queryset下面没有做我需要的,因为其他合作伙伴也索引了。

class ProductIndexes(CelerySearchIndex, indexes.Indexable):
    text = indexes.EdgeNgramField(
            document=True, use_template=True,
            template_name='search/indexes/cpu/item_text.txt')

    upc = indexes.CharField(model_attr="upc", null=True)
    title = indexes.CharField(model_attr='title', null=True)

    # Fields for faceting
    product_class = indexes.CharField(null=True, faceted=True)
    category = indexes.MultiValueField(null=True, faceted=True)
    partner = indexes.MultiValueField(null=True, faceted=True)
    price …
Run Code Online (Sandbox Code Playgroud)

django solr django-haystack django-oscar

5
推荐指数
1
解决办法
328
查看次数

实现 Django-oscar COD

现在已经1周了,我无法弄清楚在django-oscar中实现COD的方法。如果有人至少能给我一个开始来完成这项任务,我将非常感激。我曾尝试使用很少的Github存储库,但它们要么已经过时,要么不够清晰,无法与项目一起使用。一个良好的开端足以让我从头开始。谢谢

python django django-oscar

5
推荐指数
1
解决办法
655
查看次数

在Django-Oscar中通过Paypal处理付款

我正在尝试使用Django Oscar建立一个基本的电子商务站点,并且遇到了困难。问题的大部分与缺乏如何使用有意义的付款方式(例如Paypal,Stripe,Braintree)挂钩以及我从未听说过的晦涩难懂的付款方式有关。

无论哪种方式,我都尝试使用django-oscar-paypal并遵循其文档。Paypal Express部分似乎可以正常工作,因为该按钮会出现,并且类似要签出和处理的内容。

但是,如果我选择定期进行结帐(希望用卡付款),则会转到下一页(括号中的信息是我的)

在此处输入图片说明

这是以下模板的产品:

{% extends "checkout/checkout.html" %}
{% load i18n %}

{% block title %}
    {% trans "Payment details" %} | {{ block.super }}
{% endblock %}

{% block checkout_nav %}
    {% include 'checkout/nav.html' with step=3 %}
{% endblock %}

{% block checkout_title %}{% trans "Enter payment details" %}{% endblock %}

{% block order_contents %}{% endblock %}
{% block shipping_address %}{% endblock %}
{% block shipping_method %}{% endblock %}
{% block payment_method %}{% endblock %} …
Run Code Online (Sandbox Code Playgroud)

python django paypal braintree django-oscar

5
推荐指数
1
解决办法
524
查看次数

如何在仪表板中向 django oscar 产品字段添加附加字段

如何向 django-oscar 仪表板添加附加字段?我已经分叉目录应用程序添加了一个额外的字段,但在分叉仪表板后未显示表单。

from django.db import models
from oscar.apps.catalogue.abstract_models import AbstractProduct


class Product(AbstractProduct):
    file = models.FileField(upload_to='files/%Y/%m/%d')


from oscar.apps.catalogue.models import *
Run Code Online (Sandbox Code Playgroud)

仪表板/目录/forms.py

from oscar.apps.dashboard.catalogue import forms as base_forms


class ProductForm(base_forms.ProductForm):

    class Meta(base_forms.ProductForm.Meta):

        fields = ('file',)
Run Code Online (Sandbox Code Playgroud)

python django e-commerce django-oscar

5
推荐指数
1
解决办法
492
查看次数

django 抛出“AppRegistryNotReady:应用程序尚未加载。” 当导入视图时

当我尝试将视图导入 django 应用程序的 apps.py 模块时,出现此错误。我正在使用 django 2.2.9、python 3.7.6、django-oscar 2.0.4。我已经覆盖了结帐应用程序,但此错误阻止我添加视图或更改所有 django oscar 应用程序的 url。是什么导致了这个错误?

(vsosci) c:\Users\anon\Documents\sosci.git>python manage.py check
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\anon\Envs\vsosci\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\anon\Envs\vsosci\lib\site-packages\django\core\management\__init__.py", line 357, in execute
    django.setup()
  File "C:\Users\anon\Envs\vsosci\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\anon\Envs\vsosci\lib\site-packages\django\apps\registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\anon\Envs\vsosci\lib\site-packages\django\apps\config.py", line 90, in create
    module = import_module(entry)
  File "C:\Users\anon\Envs\vsosci\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen …
Run Code Online (Sandbox Code Playgroud)

django django-oscar

5
推荐指数
1
解决办法
4805
查看次数