app/soc/views/models/site.py
changeset 901 d580a057103d
parent 858 e79e7a22326f
child 903 7110fc489fd0
equal deleted inserted replaced
900:0b416bb14970 901:d580a057103d
    32 import soc.models.site
    32 import soc.models.site
    33 import soc.logic.models.site
    33 import soc.logic.models.site
    34 import soc.logic.dicts
    34 import soc.logic.dicts
    35 
    35 
    36 
    36 
    37 class CreateForm(presence.SettingsValidationForm):
       
    38   """Django form displayed when creating or editing Site Settings.
       
    39   """
       
    40 
       
    41   class Meta:
       
    42     """Inner Meta class that defines some behavior for the form.
       
    43     """
       
    44     #: db.Model subclass for which the form will gather information
       
    45     model = soc.models.site.Site
       
    46 
       
    47     #: list of model fields which will *not* be gathered by the form
       
    48     exclude = ['scope', 'scope_path', 'link_id',
       
    49       # TODO(tlarsen): this needs to be enabled once a button to a list
       
    50       #   selection "interstitial" page is implemented, see:
       
    51       #     http://code.google.com/p/soc/issues/detail?id=151
       
    52       'home', 'tos']
       
    53 
       
    54   link_id = forms.CharField(widget=forms.HiddenInput)
       
    55 
       
    56 
       
    57 class EditForm(CreateForm):
       
    58   """Django form displayed a Document is edited.
       
    59   """
       
    60 
       
    61   pass
       
    62 
       
    63 
       
    64 class View(presence.View):
    37 class View(presence.View):
    65   """View methods for the Document model.
    38   """View methods for the Document model.
    66   """
    39   """
    67 
    40 
    68   def __init__(self, params=None):
    41   def __init__(self, params=None):
    84 
    57 
    85     new_params['name'] = "Site Settings"
    58     new_params['name'] = "Site Settings"
    86     new_params['name_short'] = "Site"
    59     new_params['name_short'] = "Site"
    87     new_params['url_name'] = "site/settings"
    60     new_params['url_name'] = "site/settings"
    88     new_params['module_name'] = "site"
    61     new_params['module_name'] = "site"
    89 
       
    90     new_params['edit_form'] = EditForm
       
    91     new_params['create_form'] = CreateForm
       
    92 
    62 
    93     new_params['sidebar_defaults'] = [('/%s/edit', 'Edit %(name)s', 'edit')]
    63     new_params['sidebar_defaults'] = [('/%s/edit', 'Edit %(name)s', 'edit')]
    94     new_params['sidebar_heading'] = new_params['name_short']
    64     new_params['sidebar_heading'] = new_params['name_short']
    95 
    65 
    96     new_params['public_template'] = 'soc/home/public.html'
    66     new_params['public_template'] = 'soc/home/public.html'