app/soc/views/models/priority_group.py
changeset 2208 1bf4e904d5f5
child 2212 4095892a3c99
equal deleted inserted replaced
2207:f283f7b99427 2208:1bf4e904d5f5
       
     1 #!/usr/bin/python2.5
       
     2 #
       
     3 # Copyright 2009 the Melange authors.
       
     4 #
       
     5 # Licensed under the Apache License, Version 2.0 (the "License");
       
     6 # you may not use this file except in compliance with the License.
       
     7 # You may obtain a copy of the License at
       
     8 #
       
     9 #   http://www.apache.org/licenses/LICENSE-2.0
       
    10 #
       
    11 # Unless required by applicable law or agreed to in writing, software
       
    12 # distributed under the License is distributed on an "AS IS" BASIS,
       
    13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    14 # See the License for the specific language governing permissions and
       
    15 # limitations under the License.
       
    16 
       
    17 """Views for Priority Groups.
       
    18 """
       
    19 
       
    20 __authors__ = [
       
    21     '"Sverre Rabbelier" <sverre@rabbelier.nl>',
       
    22   ]
       
    23 
       
    24 
       
    25 from django import forms
       
    26 
       
    27 from soc.logic import cleaning
       
    28 from soc.logic import dicts
       
    29 from soc.logic.models.priority_group import logic as priority_group_logic
       
    30 from soc.views.helper import access
       
    31 from soc.views.helper import decorators
       
    32 from soc.views.helper import dynaform
       
    33 from soc.views.helper import widgets
       
    34 from soc.views.models import base
       
    35 
       
    36 
       
    37 class View(base.View):
       
    38   """View methods for the Priority Group model.
       
    39   """
       
    40 
       
    41   def __init__(self, params=None):
       
    42     """Defines the fields and methods required for the base View class
       
    43     to provide the user with list, public, create, edit and delete views.
       
    44 
       
    45     Params:
       
    46       params: a dict with params for this View
       
    47     """
       
    48 
       
    49     rights = access.Checker(params)
       
    50 
       
    51     new_params = {}
       
    52     new_params['rights'] = rights
       
    53     new_params['logic'] = priority_group_logic
       
    54 
       
    55     new_params['name'] = "Priority Group"
       
    56 
       
    57     new_params['no_create_raw'] = True
       
    58     new_params['no_create_with_scope'] = True
       
    59     new_params['no_create_with_key_fields'] = True
       
    60 
       
    61     params = dicts.merge(params, new_params)
       
    62 
       
    63     super(View, self).__init__(params=params)
       
    64 
       
    65 
       
    66 view = View()
       
    67 
       
    68 delete = decorators.view(view.delete)
       
    69 edit = decorators.view(view.edit)
       
    70 list = decorators.view(view.list)
       
    71 public = decorators.view(view.public)