product list and article list

This commit is contained in:
sanj 2010-07-29 01:03:47 +05:30
parent 300487e744
commit 6e76a8dd3c
5 changed files with 29 additions and 4 deletions

View File

@ -25,9 +25,10 @@ urlpatterns = patterns('',
(r'^print_article/$', views.article_pdf),
(r'^article_frontend/(?P<product_id>\d+)/(?P<article_order>\d+)/$', views.article_frontend),
(r'^issue/(?P<id>\d+)/$', views.edit_issue),
(r'^issue_list/', views.issue_list),
(r'^product/(?P<id>\d+)/$', views.edit_product),
(r'^new_issue/', views.new_issue),
(r'^page_pdf/', views.page_pdf),
(r'^product_pdf/', views.product_pdf),
(r'^poll_changes/', views.poll_changes),
(r'', views.product_list),
)

View File

@ -644,9 +644,9 @@ def delete_page(request):
}
return HttpResponse(json.dumps(r), mimetype="application/json")
def issue_list(request):
issues = Issue.objects.all().order_by('issue_no')
return render_to_response("issue_list.html", {'issues': issues})
def product_list(request):
products = Product.objects.all()
return render_to_response("product_list.html", {'products': products})
def new_issue(request):
name = request.GET['issueName']
@ -660,6 +660,10 @@ def edit_issue(request, id):
i = Issue.objects.get(pk=id)
return render_to_response
def edit_product(request, id):
p = Product.objects.get(pk=id)
articles = Article.objects.filter(product=p)
return render_to_response("article_list.html", {'product': p, 'articles': articles})
"""
These are some views that I could think of that need to be created. Please add more.

View File

@ -0,0 +1,9 @@
{% extends 'base.html' %}
{% block content %}
{{ p.title }}
{% for a in articles %}
<a href="/edit/article/{{a.id}}/">{{ a.name }}</a><br />
{% endfor %}
{% endblock %}

View File

@ -1,5 +1,8 @@
<html>
<head>
{% block head %}
{% endblock %}
</head>
<body>
{% block content %}

View File

@ -0,0 +1,8 @@
{% extends 'base.html' %}
{% block content %}
{% for p in products %}
<a href="/edit/product/{{p.id}}/">{{ p.title }}</a><br />
{% endfor %}
{% endblock %}