articles list on /edit/

This commit is contained in:
Sanj 2011-05-11 01:47:48 +05:30
parent 718f6d6f95
commit cfbe017711
5 changed files with 24 additions and 8 deletions

View File

@ -31,5 +31,5 @@ urlpatterns = patterns('',
(r'^page_pdf/', views.page_pdf),
(r'^product_pdf/', views.product_pdf),
(r'^poll_changes/', views.poll_changes),
(r'', views.product_list),
(r'', views.article_list),
)

View File

@ -665,6 +665,10 @@ def product_list(request):
products = Product.objects.all()
return render_to_response("product_list.html", {'products': products})
def article_list(request):
articles = Article.objects.all()
return render_to_response("article_list.html", {'articles': articles})
def new_issue(request):
name = request.GET['issueName']
last_issue_no = Issue.objects.all().order_by('-issue_no')[0].issue_no

View File

@ -1,5 +1,9 @@
from models import File
import os
try:
import json
except:
import simplejson as json
def clean_nulls():
x = []
@ -33,10 +37,19 @@ def file_exists():
def manage_types():
videos = 0
audios = 0
images = 0
wooga = {}
types = ['image', 'audio', 'text', 'video', 'other']
for t in types:
wooga[t] = 0
for f in File.objects.all():
typ = f.type
try:
wooga[typ] += 1
except KeyError:
print typ
print json.dumps(wooga, indent=4)
def correct_types():
types = ['image', 'audio', 'text', 'video', 'other']

View File

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

View File

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