示例#1
0
def search(request,words,list_per_page,page_index):
    form=SearchForm(action=url_for('core/search_post'))
    data=Moshimo.get_by_search_word(words,list_per_page,page_index)
    data['categories']=[u'検索',words]
    data['form']=form.as_widget()

    return render_to_response('core/product_list.html', data)
示例#2
0
def tags(request,tags,list_per_page,page_index):
    form=SearchForm(action='/search_post')
    data=Moshimo.get_by_tags(tags,list_per_page,page_index)
    data['categories']=[u'タグ',tags]
    data['form']=form.as_widget()

    return render_to_response('core/product_list.html',data)
示例#3
0
def products(request,category_code,list_per_page,page_index):
    form=SearchForm(action='/search_post')
    data=Moshimo.get_by_category(category_code,list_per_page,page_index)
    data['categories']=Moshimo.get_category_name(category_code)
    data['form']=form.as_widget()

    return render_to_response('core/product_list.html',data)
示例#4
0
def detail(request,article_id):
    from core.models import Product
    form=SearchForm(action='/search_post')
    data=Moshimo.get_by_article_id(article_id)
    data['form']=form.as_widget()

    return render_to_response('core/detail.html', data)
示例#5
0
def product(request):
    from core.forms import ProductForm
    from core.forms import SearchForm
    product_form=ProductForm()
    search_form=SearchForm()
    if request.method=='POST' and product_form.validate(request.form):
        product_form.save(key_name=form['article_id'])
    return render_to_response('admin/product.html', {'form':search_form.as_widget(),'product_form': product_form.as_widget()})
示例#6
0
def sitemap(request):
    from admin.forms import SitemapForm
    from core.forms import SearchForm
    from core.models import Sitemap
    from google.appengine.ext import deferred
    sitemap_form=SitemapForm()
    search_form=SearchForm()
    if request.method=='POST' and sitemap_form.validate(request.form):
        if form['mode']==u'更新':
            deferred.defer(Sitemap.update_article_id,form['article_id'])
        else:
            deferred.defer(Sitemap.set_article_id,form['article_id'])
    return render_to_response('admin/sitemap.html', {'form':search_form.as_widget(),'sitemap_form': sitemap_form.as_widget()})
示例#7
0
def index(request):
    u"""
    トップページ
    新入荷商品:Moshimo.get_new_item
    ヒット商品:Moshimo.get_sales_item
    """
    from moshimo import Moshimo
    from core.forms import SearchForm
    from kay.utils import render_to_response

    form=SearchForm(action='/search_post')
    salesitem_data=Moshimo.get_sales_item()
    newitem_data=Moshimo.get_new_item()

    return render_to_response('core/index.html', {
        'form':form.as_widget(),
        'newitem':newitem_data,
        'salesitem':salesitem_data,
    })
示例#8
0
def index(request):
    from core.forms import SearchForm
    form=SearchForm()
    return render_to_response('admin/index.html',{'form':form.as_widget()})