summaryrefslogtreecommitdiff
path: root/public/views.py
blob: 330f04b4535be8f2d994efa92bda6c6cbdf190c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from main.models import Arch, Repo, Donor
from mirrors.models import MirrorUrl
from news.models import News
from . import utils

from django.contrib.auth.models import User
from django.db.models import Q
from django.views.generic import list_detail
from django.views.generic.simple import direct_to_template
from django.shortcuts import redirect


def index(request):
    pkgs = utils.get_recent_updates()
    context = {
        'news_updates': News.objects.order_by('-postdate', '-id')[:10],
        'pkg_updates': pkgs,
    }
    return direct_to_template(request, 'public/index.html', context)

def userlist(request, type='Developers'):
    users = User.objects.order_by('username').select_related('userprofile')
    if type == 'Hackers':
        users = users.filter(is_active=True, groups__name="Hackers")
        msg = "This is a list of the current Parabola GNU/Linux hackers. They maintain the *-libre packages in addition to doing any other developer duties."
    elif type == 'Fellows':
        users = users.filter(is_active=False)
        msg = "Below you can find a list of ex-hackers (aka project fellows). These folks helped make Parabola what it is today. Thanks!"

    context = {
        'user_type': type,
        'description': msg,
        'users': users,
    }
    return direct_to_template(request, 'public/userlist.html', context)

def donate(request):
    context = {
        'donors': Donor.objects.filter(visible=True).order_by('name'),
    }
    return direct_to_template(request, 'public/donate.html', context)

def download(request):
    return redirect('http://wiki.parabolagnulinux.org/get', permanent=True)

def feeds(request):
    context = {
        'arches': Arch.objects.all(),
        'repos': Repo.objects.all(),
    }
    return direct_to_template(request, 'public/feeds.html', context)

# vim: set ts=4 sw=4 et: