X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/2f9cb34a07fcd98effda2fa900e48c31813f14c8..eb769f1b951951ebd6cb55060f2f61a8c25d5aac:/apps/organizations/views.py diff --git a/apps/organizations/views.py b/apps/organizations/views.py index a7d69802..47aa5d34 100644 --- a/apps/organizations/views.py +++ b/apps/organizations/views.py @@ -1,12 +1,18 @@ -# Create your views here. +# -*- coding: utf-8 -*- +# +# This file is part of MIL/PEER, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.shortcuts import render, redirect -from django.http import HttpResponse, Http404 -#from django.views.decorators import require_post +from django.http import Http404 + +from organizations.filters import OrganizationFilterSet from .forms import OrganizationForm, UserCardForm from .models import Organization, Membership, UserCard + @login_required def org_new(request): if request.method == 'POST': @@ -38,6 +44,7 @@ def main(request, pk, tab='documents'): 'am_member': am_member, }) + def user_card(request, pk): try: user = User.objects.get(pk=pk) @@ -92,8 +99,8 @@ def join(request, pk): return render(request, 'organizations/join.html', {'org': org}) + @login_required -#@POST_required def membership(request, pk): try: org = Organization.objects.get(pk=pk) @@ -115,6 +122,7 @@ def membership(request, pk): def organizations(request): + f = OrganizationFilterSet(request.GET, queryset=Organization.objects.all()) return render(request, "organizations/organizations.html", { - 'organizations': Organization.objects.all(), + 'filter_set': f, })