app/soc/views/models/club.py
author Lennard de Rijk <ljvderijk@gmail.com>
Mon, 26 Jan 2009 21:22:53 +0000
changeset 1006 6abf12b9e646
parent 1005 46b3e946a3e1
child 1007 3b66772d21a5
permissions -rw-r--r--
Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     2
#
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     4
#
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     8
#
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    10
#
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    16
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    17
"""Views for Clubs.
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    18
"""
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    19
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    20
__authors__ = [
800
738f6335b0e2 Added a create method that uses an existing application
Sverre Rabbelier <srabbelier@gmail.com>
parents: 799
diff changeset
    21
    '"Sverre Rabbelier" <sverre@rabbelier.nl>',
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    22
    '"Lennard de Rijk" <ljvderijk@gmail.com>',
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    23
  ]
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    24
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    25
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    26
from google.appengine.api import users
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    27
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
    28
from django import http
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    29
from django import forms
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    30
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    31
from soc.logic import dicts
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    32
from soc.logic.models import user as user_logic
882
267e31f1a0b6 Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 878
diff changeset
    33
from soc.logic.models import club_app as club_app_logic
800
738f6335b0e2 Added a create method that uses an existing application
Sverre Rabbelier <srabbelier@gmail.com>
parents: 799
diff changeset
    34
from soc.logic.models import club as club_logic
983
1bbf226ade8e Added request listing for Club Admins.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 963
diff changeset
    35
from soc.logic.models import request as request_logic
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
    36
from soc.views import out_of_band
802
95c534d02e39 Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 800
diff changeset
    37
from soc.views.helper import access
878
fdfab50cc9df Fix trailing whitespace and apply decorators
Sverre Rabbelier <srabbelier@gmail.com>
parents: 877
diff changeset
    38
from soc.views.helper import decorators
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
    39
from soc.views.helper import dynaform
1003
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
    40
from soc.views.helper import redirects
896
445f3e8a44d9 Fixed import sorting and indentation in soc/views/models/club.py
Lennard de Rijk <ljvderijk@gmail.com>
parents: 884
diff changeset
    41
from soc.views.helper import responses
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    42
from soc.views.helper import widgets
989
f52654ea6350 Moved listRequests from club to group view.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 983
diff changeset
    43
from soc.views.models import group
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    44
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    45
import soc.logic.models.club
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
    46
import soc.views.helper
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    47
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    48
989
f52654ea6350 Moved listRequests from club to group view.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 983
diff changeset
    49
class View(group.View):
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    50
  """View methods for the Club model.
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    51
  """
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    52
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    53
  def __init__(self, params=None):
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    54
    """Defines the fields and methods required for the base View class
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    55
    to provide the user with list, public, create, edit and delete views.
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    56
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    57
    Params:
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    58
      params: a dict with params for this View
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    59
    """
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    60
802
95c534d02e39 Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 800
diff changeset
    61
    rights = {}
944
5ea2bd9e3fa6 Refactored invite system from club_admin to role to make the system work with host as well.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 934
diff changeset
    62
    rights['create'] = [access.checkIsDeveloper]
814
25ffebd9fa8f Implement the checkIsClubAppAccepted function
Sverre Rabbelier <srabbelier@gmail.com>
parents: 802
diff changeset
    63
    rights['edit'] = [access.checkIsClubAdminForClub]
944
5ea2bd9e3fa6 Refactored invite system from club_admin to role to make the system work with host as well.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 934
diff changeset
    64
    rights['delete'] = [access.checkIsDeveloper]
1003
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
    65
    rights['home'] = [access.allow]
944
5ea2bd9e3fa6 Refactored invite system from club_admin to role to make the system work with host as well.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 934
diff changeset
    66
    rights['list'] = [access.checkIsDeveloper]
1006
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
    67
    rights['apply_member'] = [access.checkAgreesToSiteToS]
983
1bbf226ade8e Added request listing for Club Admins.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 963
diff changeset
    68
    rights['list_requests'] = [access.checkIsClubAdminForClub]
998
125257161908 Implemented the listing of all the roles in for a specific group.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 993
diff changeset
    69
    rights['list_roles'] = [access.checkIsClubAdminForClub]
884
ded4850776c8 Changed checkIsClubAppAccepted into a more generic checkIsApplicationAccepted.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 882
diff changeset
    70
    rights['applicant'] = [access.checkIsApplicationAccepted(club_app_logic)]
802
95c534d02e39 Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 800
diff changeset
    71
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    72
    new_params = {}
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    73
    new_params['logic'] = soc.logic.models.club.logic
802
95c534d02e39 Added Club Admin model, logic, and view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 800
diff changeset
    74
    new_params['rights'] = rights
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
    75
    new_params['name'] = "Club"
1006
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
    76
    new_params['url_name'] = "club"
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
    77
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
    78
    patterns = []
983
1bbf226ade8e Added request listing for Club Admins.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 963
diff changeset
    79
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
    80
    patterns += [(r'^%(url_name)s/(?P<access_type>applicant)/%(key_fields)s$',
983
1bbf226ade8e Added request listing for Club Admins.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 963
diff changeset
    81
        'soc.views.models.%(module_name)s.applicant', 
1006
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
    82
        "%(name)s Creation via Accepted Application"),
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
    83
        (r'^%(url_name)s/(?P<access_type>apply_member)$',
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
    84
        'soc.views.models.%(module_name)s.apply_member', 
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
    85
        "List of all %(name_plural)s you can apply to"),]
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
    86
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
    87
    new_params['extra_django_patterns'] = patterns
799
30a912906a57 Construct names automatically from base name.
Sverre Rabbelier <srabbelier@gmail.com>
parents: 790
diff changeset
    88
1006
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
    89
    new_params['sidebar_additional'] = [
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
    90
        ('/' + new_params['url_name'] + '/apply_member', 'Join a Club', 'list_apply'),]
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
    91
846
65daaf006399 Remove member_template from extra_dynaexclude in soc.views.models.club since member_template is only available in Organization as of recent commit.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 814
diff changeset
    92
    new_params['extra_dynaexclude'] = ['founder', 'home']
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    93
    new_params['edit_extra_dynafields'] = {
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    94
        'founded_by': forms.CharField(widget=widgets.ReadOnlyInput(),
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    95
                                   required=False),
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    96
        }
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    97
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    98
    params = dicts.merge(params, new_params)
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
    99
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   100
    super(View, self).__init__(params=params)
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   101
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   102
    # create and store the special form for applicants
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   103
    updated_fields = {
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   104
        'link_id': forms.CharField(widget=widgets.ReadOnlyInput(),
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   105
            required=False)}
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   106
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   107
    applicant_create_form = dynaform.extendDynaForm(
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   108
        dynaform = self._params['create_form'],
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   109
        dynafields = updated_fields)
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   110
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   111
    params['applicant_create_form'] = applicant_create_form
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   112
878
fdfab50cc9df Fix trailing whitespace and apply decorators
Sverre Rabbelier <srabbelier@gmail.com>
parents: 877
diff changeset
   113
  @decorators.merge_params
fdfab50cc9df Fix trailing whitespace and apply decorators
Sverre Rabbelier <srabbelier@gmail.com>
parents: 877
diff changeset
   114
  @decorators.check_access
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   115
  def applicant(self, request, access_type,
907
3786030d5952 Fix idention in soc.views.models.club module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 896
diff changeset
   116
                page_name=None, params=None, **kwargs):
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   117
    """Handles the creation of a club via an approved club application.
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   118
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   119
    Args:
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   120
      request: the standard Django HTTP request object
919
3f9072bab1d4 Added missing comment to soc/views/models/club.py.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 907
diff changeset
   121
      access_type : the name of the access type which should be checked
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   122
      page_name: the page name displayed in templates as page and header title
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   123
      params: a dict with params for this View
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   124
      kwargs: the Key Fields for the specified entity
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   125
    """
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   126
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   127
    # get the context for this webpage
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   128
    context = responses.getUniversalContext(request)
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   129
    context['page_name'] = page_name
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   130
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   131
    if request.method == 'POST':
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   132
      return self.applicantPost(request, context, params, **kwargs)
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   133
    else:
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   134
      # request.method == 'GET'
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   135
      return self.applicantGet(request, context, params, **kwargs)
800
738f6335b0e2 Added a create method that uses an existing application
Sverre Rabbelier <srabbelier@gmail.com>
parents: 799
diff changeset
   136
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   137
  def applicantGet(self, request, context, params, **kwargs):
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   138
    """Handles the GET request concerning the creation of a club via an
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   139
    approved club application.
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   140
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   141
    Args:
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   142
      request: the standard Django HTTP request object
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   143
      context: dictionary containing the context for this view
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   144
      params: a dict with params for this View
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   145
      kwargs: the Key Fields for the specified entity
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   146
    """
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   147
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   148
    # find the application
882
267e31f1a0b6 Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 878
diff changeset
   149
    key_fields = club_app_logic.logic.getKeyFieldsFromDict(kwargs)
267e31f1a0b6 Added club_app model and logic.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 878
diff changeset
   150
    application = club_app_logic.logic.getFromFields(**key_fields)
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   151
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   152
    # extract the application fields
800
738f6335b0e2 Added a create method that uses an existing application
Sverre Rabbelier <srabbelier@gmail.com>
parents: 799
diff changeset
   153
    field_names = application.properties().keys()
738f6335b0e2 Added a create method that uses an existing application
Sverre Rabbelier <srabbelier@gmail.com>
parents: 799
diff changeset
   154
    fields = dict( [(i, getattr(application, i)) for i in field_names] )
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   155
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   156
    # create the form using the fields from the application as the initial value
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   157
    form = params['applicant_create_form'](initial=fields)
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   158
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   159
    # construct the appropriate response
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   160
    return super(View, self)._constructResponse(request, entity=None,
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   161
        context=context, form=form, params=params)
800
738f6335b0e2 Added a create method that uses an existing application
Sverre Rabbelier <srabbelier@gmail.com>
parents: 799
diff changeset
   162
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   163
  def applicantPost(self, request, context, params, **kwargs):
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   164
    """Handles the POST request concerning the creation of a club via an
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   165
    approved club application.
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   166
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   167
    Args:
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   168
      request: the standard Django HTTP request object
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   169
      context: dictionary containing the context for this view
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   170
      params: a dict with params for this View
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   171
      kwargs: the Key Fields for the specified entity
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   172
    """
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   173
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   174
    # populate the form using the POST data
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   175
    form = params['applicant_create_form'](request.POST)
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   176
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   177
    if not form.is_valid():
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   178
      # return the invalid form response
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   179
      return self._constructResponse(request, entity=None, context=context,
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   180
          form=form, params=params)
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   181
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   182
    # collect the cleaned data from the valid form
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   183
    key_name, fields = soc.views.helper.forms.collectCleanedFields(form)
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   184
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   185
    # fill in the founder of the club
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   186
    account = users.get_current_user()
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   187
    user = user_logic.logic.getForFields({'account': account}, unique=True)
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   188
    fields['founder'] = user
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   189
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   190
    if not key_name:
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   191
      key_fields =  self._logic.getKeyFieldsFromDict(fields)
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   192
      key_name = self._logic.getKeyNameForFields(key_fields)
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   193
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   194
    # create the club entity
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   195
    entity = self._logic.updateOrCreateFromKeyName(fields, key_name)
877
b2575da44c36 Fix whitespace damage
Sverre Rabbelier <srabbelier@gmail.com>
parents: 869
diff changeset
   196
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   197
    # redirect to notifications list to see the admin invite
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   198
    return http.HttpResponseRedirect('/notification/list')
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   199
983
1bbf226ade8e Added request listing for Club Admins.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 963
diff changeset
   200
1006
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   201
  @decorators.merge_params
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   202
  @decorators.check_access
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   203
  def applyMember(self, request, access_type,
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   204
                page_name=None, params=None, **kwargs):
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   205
    """Shows a list of all clubs and you can choose one to apply to become a member.
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   206
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   207
    Args:
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   208
      request: the standard Django HTTP request object
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   209
      access_type : the name of the access type which should be checked
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   210
      page_name: the page name displayed in templates as page and header title
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   211
      params: a dict with params for this View
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   212
      kwargs: the Key Fields for the specified entity
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   213
    """
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   214
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   215
    list_params = params.copy()
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   216
    list_params['list_action'] = (redirects.getRequestRedirectForRole, 'club_member')
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   217
    list_params['list_description'] = 'Choose a club to apply to become a Club Member'
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   218
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   219
    return self.list(request, access_type, 
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   220
        page_name, params=list_params, filter=None)
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   221
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   222
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   223
  def _editGet(self, request, entity, form):
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   224
    """See base.View._editGet().
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   225
    """
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   226
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   227
    # fill in the founded_by with data from the entity
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   228
    form.fields['founded_by'].initial = entity.founder.name
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   229
    super(View, self)._editGet(request, entity, form)
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   230
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   231
  def _editPost(self, request, entity, fields):
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   232
    """See base.View._editPost().
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   233
    """
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   234
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   235
    if not entity:
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   236
      # only if we are creating a new entity we should fill in founder
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   237
      account = users.get_current_user()
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   238
      user = user_logic.logic.getForFields({'account': account}, unique=True)
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   239
      fields['founder'] = user
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   240
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   241
    super(View, self)._editPost(request, entity, fields)
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   242
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   243
1003
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   244
  def _getExtraMenuItems(self, role_description, params=None):
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   245
    """Used to create the specific club menu entries.
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   246
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   247
    For args see group.View._getExtraMenuItems().
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   248
    """
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   249
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   250
    submenus = []
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   251
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   252
    group_entity = role_description['group']
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   253
    roles = role_description['roles']
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   254
  
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   255
    if roles.get('club_admin'):
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   256
      # add a link to the management page
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   257
      submenu = (redirects.getListRolesRedirect(group_entity, params), 
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   258
          "Manage Admins and Members", 'any_access')
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   259
      submenus.append(submenu)
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   260
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   261
      # add a link to invite an admin
1005
46b3e946a3e1 Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1004
diff changeset
   262
      submenu = (redirects.getInviteRedirectForRole(group_entity, 'club_admin'), 
1003
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   263
          "Invite an Admin", 'any_access')
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   264
      submenus.append(submenu)
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   265
1004
bfc8e9582c47 Fixed typo in club sidebar entry.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1003
diff changeset
   266
      # add a link to invite a member
1005
46b3e946a3e1 Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1004
diff changeset
   267
      submenu = (redirects.getInviteRedirectForRole(group_entity, 'club_member'), 
1004
bfc8e9582c47 Fixed typo in club sidebar entry.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1003
diff changeset
   268
          "Invite a Member", 'any_access')
1003
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   269
      submenus.append(submenu)
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   270
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   271
      # add a link to the request page
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   272
      submenu = (redirects.getListRequestsRedirect(group_entity, params), 
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   273
          "List Requests and Invites", 'any_access')
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   274
      submenus.append(submenu)
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   275
1005
46b3e946a3e1 Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1004
diff changeset
   276
      # add a link to the edit page
46b3e946a3e1 Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1004
diff changeset
   277
      submenu = (redirects.getEditRedirect(group_entity, params), 
46b3e946a3e1 Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1004
diff changeset
   278
          "Edit Club Profile", 'any_access')
46b3e946a3e1 Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1004
diff changeset
   279
      submenus.append(submenu)
46b3e946a3e1 Changed method name in access.py to fix overwriting another method.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1004
diff changeset
   280
1003
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   281
      # TODO(ljvderijk) add more usefull links, like resign as admin/member
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   282
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   283
    return submenus
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   284
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   285
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   286
view = View()
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   287
869
cd17698846ce Added a new view to help with application -> group process.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 858
diff changeset
   288
applicant = view.applicant
1006
6abf12b9e646 Added a sidebar link for all users that accepted the ToS to a view that allows you to choose a club which you want to become a member for.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 1005
diff changeset
   289
apply_member = view.applyMember
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   290
create = view.create
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   291
delete = view.delete
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   292
edit = view.edit
1003
b13da1ddcd50 Added sidebar entries for club entities.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 998
diff changeset
   293
home = view.home
782
27924b0f13cd Fixed missing files in r1364.
Lennard de Rijk <ljvderijk@gmail.com>
parents:
diff changeset
   294
list = view.list
983
1bbf226ade8e Added request listing for Club Admins.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 963
diff changeset
   295
list_requests = view.listRequests
998
125257161908 Implemented the listing of all the roles in for a specific group.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 993
diff changeset
   296
list_roles = view.listRoles
814
25ffebd9fa8f Implement the checkIsClubAppAccepted function
Sverre Rabbelier <srabbelier@gmail.com>
parents: 802
diff changeset
   297
public = view.public
858
e79e7a22326f Add an export() view, and implement it as text/text for Document.
Todd Larsen <tlarsen@google.com>
parents: 846
diff changeset
   298
export = view.export
934
9fcc08971efe Add a 'pick' view to the appropriate views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 919
diff changeset
   299
pick = view.pick