-# 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':
'am_member': am_member,
})
+
def user_card(request, pk):
try:
user = User.objects.get(pk=pk)
return render(request, 'organizations/join.html', {'org': org})
+
@login_required
-#@POST_required
def membership(request, pk):
try:
org = Organization.objects.get(pk=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,
})