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'^page_pdf/', views.page_pdf),
(r'^product_pdf/', views.product_pdf), (r'^product_pdf/', views.product_pdf),
(r'^poll_changes/', views.poll_changes), (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() products = Product.objects.all()
return render_to_response("product_list.html", {'products': products}) 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): def new_issue(request):
name = request.GET['issueName'] name = request.GET['issueName']
last_issue_no = Issue.objects.all().order_by('-issue_no')[0].issue_no last_issue_no = Issue.objects.all().order_by('-issue_no')[0].issue_no

View File

@ -1,5 +1,9 @@
from models import File from models import File
import os import os
try:
import json
except:
import simplejson as json
def clean_nulls(): def clean_nulls():
x = [] x = []
@ -33,10 +37,19 @@ def file_exists():
def manage_types(): def manage_types():
videos = 0 wooga = {}
audios = 0 types = ['image', 'audio', 'text', 'video', 'other']
images = 0 for t in types:
wooga[t] = 0
for f in File.objects.all(): for f in File.objects.all():
typ = f.type 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' %} {% extends 'base.html' %}
{% block content %} {% block body %}
{{ p.title }}
{% for a in articles %} {% for a in articles %}
<a href="/edit/article/{{a.id}}/">{{ a.name }}</a><br /> <a href="/edit/article/{{a.id}}/">{{ a.name }}</a><br />
{% endfor %} {% endfor %}

View File

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