app/soc/views/models/site.py
changeset 542 7cc99461b64d
parent 537 f2bd9c465a6d
child 544 10f9da7e0d17
equal deleted inserted replaced
541:d572b0fb6bfe 542:7cc99461b64d
    52     model = soc.models.site.Site
    52     model = soc.models.site.Site
    53 
    53 
    54     #: list of model fields which will *not* be gathered by the form
    54     #: list of model fields which will *not* be gathered by the form
    55     exclude = ['inheritance_line', 'home', 'scope', 'scope_path', 'link_id']
    55     exclude = ['inheritance_line', 'home', 'scope', 'scope_path', 'link_id']
    56 
    56 
    57   scope_path = forms.CharField(widget=forms.HiddenInput)
    57 #  scope_path = forms.CharField(widget=forms.HiddenInput)
    58 
    58 
    59   link_id = forms.CharField(widget=forms.HiddenInput)
    59 #  link_id = forms.CharField(widget=forms.HiddenInput)
    60 
    60 
    61 
    61 
    62 class EditForm(CreateForm):
    62 class EditForm(CreateForm):
    63   """Django form displayed a Document is edited.
    63   """Django form displayed a Document is edited.
    64   """
    64   """
    78       original_params: a dict with params for this View
    78       original_params: a dict with params for this View
    79     """
    79     """
    80 
    80 
    81     params = {}
    81     params = {}
    82 
    82 
    83     # add ugettext_lazy ?
    83     # TODO(alturin): add ugettext_lazy ?
    84     params['name'] = "Site Settings"
    84     params['name'] = "Site Settings"
    85     params['name_short'] = "Site Settings"
    85     params['name_short'] = "Site"
    86     params['name_plural'] = "Site Settings"
    86     params['name_plural'] = "Site Settings"
    87     # lower name and replace " " with "/"
    87     # lower name and replace " " with "/"
    88     # for module name lower name and replace " " with "_"
       
    89     params['url_name'] = "site/settings"
    88     params['url_name'] = "site/settings"
    90     params['module_name'] = "site"
    89     params['module_name'] = "site"
    91 
    90 
    92     params['edit_form'] = EditForm
    91     params['edit_form'] = EditForm
    93     params['create_form'] = CreateForm
    92     params['create_form'] = CreateForm
       
    93 
       
    94     params['sidebar_defaults'] = [('/%s/edit', 'Edit %(name)s')]
       
    95     params['sidebar_heading'] = params['name_short']
    94 
    96 
    95     params['lists_template'] = {
    97     params['lists_template'] = {
    96       'list_main': 'soc/list/list_main.html',
    98       'list_main': 'soc/list/list_main.html',
    97       'list_pagination': 'soc/list/list_pagination.html',
    99       'list_pagination': 'soc/list/list_pagination.html',
    98       'list_row': 'soc/site/list/site_row.html',
   100       'list_row': 'soc/site/list/site_row.html',
    99       'list_heading': 'soc/site/list/site_heading.html',
   101       'list_heading': 'soc/site/list/site_heading.html',
   100     }
   102     }
   101 
   103 
   102     params['delete_redirect'] = '/' + params['url_name'] + '/list'
   104     params['delete_redirect'] = '/' + params['url_name'] + '/list'
   103 
       
   104     params['sidebar_additional'] = [
       
   105         ('/' + params['url_name'] + '/edit', 'Edit Main Site Settings')]
       
   106 
   105 
   107     params = dicts.merge(original_params, params)
   106     params = dicts.merge(original_params, params)
   108 
   107 
   109     presence.View.__init__(self, original_params=params)
   108     presence.View.__init__(self, original_params=params)
   110 
   109