projects tab in top menu
[redakcja.git] / apps / organizations / views.py
index a7d6980..47aa5d3 100644 (file)
@@ -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,
     })