Django商店比较应用程序
django-mp-shop-comparison的Python项目详细描述
#mp shop comparison
安装:
1)使用pip安装:
````
pip安装django mp shop comparison
`````
2)将“comparison”添加到“installed_apps”中。
3)将“comparison.middleware.comparisonmiddleware”添加到“middleware”中。
4)添加“path('comparison/”,include('comparison.urls')`到'urlpatterns`.
模板示例:
``````
`````
``````
{%if_product_in謺comparison object.id%}
<;a href=“{%url”comparison:remove'product id%}?下一步={{request.get_full_path}“>;
删除
<;/a>;
{%else%}
<;a href={%url'比较:添加'product_id%}?next={{request.get_full_path}“>;
添加
<;/a>;
{%endif%}
```
```
{%br/>{%if{%if{%if{%if{%endif{%endif}
` ` ` `
` ` ` `{{{{{{{{{{{{}}}{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}}}{{{{{/><;ul>;
{%用于请求中的类别。comparison.get_categories%}
<;li>;
<;a href=“{%url”products:comparison'category.id%}”>;
{{{category.name}
<;a>;
<;li>;
{%endfor%}
<;ul>;
{%endif%}
````
U 404(产品类别,id=类别id)
products=请求.比较.获取产品(类别id)
context={
“类别”:类别,
“产品”:产品,
“属性”:格式比较属性(类别,产品)
返回呈现(请求,'products/comparison.html',上下文)
def格式属性(类别,产品):
attributes=category.attributes.visible()
values={attr.id:{}用于attr in attributes}
属性属性:
attrs.append({
‘name’:attr.name,[attr_val.attr_id][attr_val.product_id]=attr_val.as_html()
'values':[values[attr.id.id].get(p.id)for p in products]
}
return attrs
````
35
'values'
'values'
```````
>````````````
``````````` ` ` ` ` ` ` ``
从比较:
```
请求.比较.删除(产品id)
````
比较:
`````
请求。比较。获取产品(分类号)的方法
``````
check是比较中的产品的方法:
`````
```````
请求。比较。获取产品(产品号)的方法
````
获取比较产品的分类
`````````
```````````
`````````````
````````````````
`````````````````````````````Django>;=2.0.6
*python>;=3.5.2
安装:
1)使用pip安装:
````
pip安装django mp shop comparison
`````
2)将“comparison”添加到“installed_apps”中。
3)将“comparison.middleware.comparisonmiddleware”添加到“middleware”中。
4)添加“path('comparison/”,include('comparison.urls')`到'urlpatterns`.
模板示例:
``````
`````
``````
{%if_product_in謺comparison object.id%}
<;a href=“{%url”comparison:remove'product id%}?下一步={{request.get_full_path}“>;
删除
<;/a>;
{%else%}
<;a href={%url'比较:添加'product_id%}?next={{request.get_full_path}“>;
添加
<;/a>;
{%endif%}
```
```
{%br/>{%if{%if{%if{%if{%endif{%endif}
` ` ` `
` ` ` `{{{{{{{{{{{{}}}{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}}}{{{{{/><;ul>;
{%用于请求中的类别。comparison.get_categories%}
<;li>;
<;a href=“{%url”products:comparison'category.id%}”>;
{{{category.name}
<;a>;
<;li>;
{%endfor%}
<;ul>;
{%endif%}
````
U 404(产品类别,id=类别id)
products=请求.比较.获取产品(类别id)
context={
“类别”:类别,
“产品”:产品,
“属性”:格式比较属性(类别,产品)
返回呈现(请求,'products/comparison.html',上下文)
def格式属性(类别,产品):
attributes=category.attributes.visible()
values={attr.id:{}用于attr in attributes}
属性属性:
attrs.append({
‘name’:attr.name,[attr_val.attr_id][attr_val.product_id]=attr_val.as_html()
'values':[values[attr.id.id].get(p.id)for p in products]
}
return attrs
````
35
'values'
'values'
```````
>````````````
``````````` ` ` ` ` ` ` ``
从比较:
```
请求.比较.删除(产品id)
````
比较:
`````
请求。比较。获取产品(分类号)的方法
``````
check是比较中的产品的方法:
`````
```````
请求。比较。获取产品(产品号)的方法
````
获取比较产品的分类
`````````
```````````
`````````````
````````````````
`````````````````````````````Django>;=2.0.6
*python>;=3.5.2