diff options
-rw-r--r-- | devel/views.py | 63 | ||||
-rw-r--r-- | public/__init__.py | 0 | ||||
-rw-r--r-- | public/views.py | 62 | ||||
-rw-r--r-- | settings.py | 1 |
4 files changed, 59 insertions, 67 deletions
diff --git a/devel/views.py b/devel/views.py index 19a7cdfd..3b929e96 100644 --- a/devel/views.py +++ b/devel/views.py @@ -3,11 +3,15 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.core import validators from archweb_dev.lib.utils import render_response -from archweb_dev.packages.models import Package +from archweb_dev.packages.models import Package, Repo from archweb_dev.todolists.models import Todolist, TodolistPkg from archweb_dev.settings import DATA_DIR from archweb_dev.lib.utils import validate from archweb_dev.devel.models import UserProfile +from archweb_dev.news.models import News +from archweb_dev.settings import DATA_DIR +from archweb_dev.devel.models import Donator, Mirror + @login_required def index(request): @@ -63,9 +67,60 @@ def change_profile(request): @login_required def guide(request): - return render_response(request, 'devel/pkgmaint_guide.txt', {'errors':errors,'email':request.user.email}) - return HttpResponse(file(DATA_DIR + '/pkgmaint_guide.txt').read(), - mimetype='text/plain') + return render_response(request, 'devel/pkgmaint_guide.txt', + mimetype='text/plain') + +def siteindex(request): + # get the most recent 10 news items + news = News.objects.order_by('-postdate', '-id')[:10] + pkgs = Package.objects.exclude(repo__name__exact='Testing').order_by('-last_update')[:15] + repos = Repo.objects.order_by('name') + return render_response(request, 'public/index.html', {'news_updates':news,'pkg_updates':pkgs,'repos':repos}) + +def about(request): + return render_response(request, 'public/about.html') + +def art(request): + return render_response(request, 'public/art.html') + +def cvs(request): + return render_response(request, 'public/cvs.html') + +def developers(request): + devs = User.objects.order_by('username') + return render_response(request, 'public/developers.html', {'devs':devs}) + +def donate(request): + donor_count = Donator.objects.count() + splitval = donor_count / 4 + slice1 = Donator.objects.all()[:splitval] + slice2 = Donator.objects.all()[(splitval):(splitval*2)] + slice3 = Donator.objects.all()[(splitval*2):(donor_count-splitval)] + slice4 = Donator.objects.all()[(donor_count-splitval):donor_count] + return render_response(request, 'public/donate.html', + {'slice1':slice1,'slice2':slice2,'slice3':slice3,'slice4':slice4}) + +def download(request): + mirrors = Mirror.objects.order_by('country', 'domain') + return render_response(request, 'public/download.html', {'mirrors':mirrors}) + +def irc(request): + return render_response(request, 'public/irc.html') + +def moreforums(request): + return render_response(request, 'public/moreforums.html') + +def press(request): + return render_response(request, 'public/press.html') + +def projects(request): + return render_response(request, 'public/projects.html') + +def robots(request): + return HttpResponse("User-agent: *\nDisallow: /\n", mimetype="text/plain") + +def denied(request): + return render_response(request, 'public/denied.html') # vim: set ts=4 sw=4 et: diff --git a/public/__init__.py b/public/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/public/__init__.py +++ /dev/null diff --git a/public/views.py b/public/views.py deleted file mode 100644 index 18f0c983..00000000 --- a/public/views.py +++ /dev/null @@ -1,62 +0,0 @@ -from django.http import HttpResponse -from archweb_dev.lib.utils import render_response -from django.contrib.auth.models import User -from archweb_dev.packages.models import Package, Repo -from archweb_dev.news.models import News -from archweb_dev.settings import DATA_DIR -from archweb_dev.devel.models import Donator, Mirror - -def index(request): - # get the most recent 10 news items - news = News.objects.order_by('-postdate', '-id')[:10] - pkgs = Package.objects.exclude(repo__name__exact='Testing').order_by('-last_update')[:15] - repos = Repo.objects.order_by('name') - return render_response(request, 'public/index.html', {'news_updates':news,'pkg_updates':pkgs,'repos':repos}) - -def about(request): - return render_response(request, 'public/about.html') - -def art(request): - return render_response(request, 'public/art.html') - -def cvs(request): - return render_response(request, 'public/cvs.html') - -def developers(request): - devs = User.objects.order_by('username') - return render_response(request, 'public/developers.html', {'devs':devs}) - -def donate(request): - donor_count = Donator.objects.count() - splitval = donor_count / 4 - slice1 = Donator.objects.all()[:splitval] - slice2 = Donator.objects.all()[(splitval):(splitval*2)] - slice3 = Donator.objects.all()[(splitval*2):(donor_count-splitval)] - slice4 = Donator.objects.all()[(donor_count-splitval):donor_count] - return render_response(request, 'public/donate.html', - {'slice1':slice1,'slice2':slice2,'slice3':slice3,'slice4':slice4}) - -def download(request): - mirrors = Mirror.objects.order_by('country', 'domain') - return render_response(request, 'public/download.html', {'mirrors':mirrors}) - -def irc(request): - return render_response(request, 'public/irc.html') - -def moreforums(request): - return render_response(request, 'public/moreforums.html') - -def press(request): - return render_response(request, 'public/press.html') - -def projects(request): - return render_response(request, 'public/projects.html') - -def robots(request): - return HttpResponse("User-agent: *\nDisallow: /\n", mimetype="text/plain") - -def denied(request): - return render_response(request, 'public/denied.html') - -# vim: set ts=4 sw=4 et: - diff --git a/settings.py b/settings.py index 8f170b6c..3e89a009 100644 --- a/settings.py +++ b/settings.py @@ -85,7 +85,6 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'archweb_dev.news', 'archweb_dev.packages', - 'archweb_dev.public', 'archweb_dev.todolists', 'archweb_dev.devel', 'archweb_dev.wiki' |