app/soc/views/models/site.py
changeset 660 5a381b290691
parent 656 a76f1b443ea4
child 702 e3b91b6955ff
equal deleted inserted replaced
659:23ef8f62d7cb 660:5a381b290691
    93       'unspecified': [access.checkIsDeveloper],
    93       'unspecified': [access.checkIsDeveloper],
    94       'any_access': [access.allow],
    94       'any_access': [access.allow],
    95       'public': [access.allow]
    95       'public': [access.allow]
    96       }
    96       }
    97 
    97 
       
    98     patterns = []
       
    99 
       
   100     page_name = "Home Page"
       
   101     patterns += [(r'^$', 'soc.views.models.%(module_name)s.main_public', 
       
   102                   page_name)]
       
   103 
       
   104     page_name = "Edit Site Settings"
       
   105     patterns += [(r'^%(url_name)s/edit$',
       
   106                   'soc.views.models.%(module_name)s.main_edit',
       
   107                   page_name)]
       
   108 
       
   109     new_params['extra_django_patterns'] = patterns
       
   110 
    98     params = dicts.merge(params, new_params)
   111     params = dicts.merge(params, new_params)
    99 
   112 
   100     super(View, self).__init__(params=params)
   113     super(View, self).__init__(params=params)
   101 
   114 
   102   def mainPublic(self, request, page_name=None, **kwargs):
   115   def mainPublic(self, request, page_name=None, **kwargs):
   133     values = self._logic.getKeyValues(None)
   146     values = self._logic.getKeyValues(None)
   134     key_values = dicts.zip(keys, values)
   147     key_values = dicts.zip(keys, values)
   135 
   148 
   136     return self.edit(request, page_name, seed=key_values, **key_values)
   149     return self.edit(request, page_name, seed=key_values, **key_values)
   137 
   150 
   138   def getDjangoURLPatterns(self, params=None):
       
   139     """See base.View.getDjangoURLPatterns().
       
   140     """
       
   141 
       
   142     page_name = "Home Page"
       
   143     patterns = super(View, self).getDjangoURLPatterns()
       
   144     patterns += [(r'^$', 'soc.views.models.site.main_public',
       
   145                  {'page_name': page_name}, page_name)]
       
   146 
       
   147     page_name = "Edit Site Settings"
       
   148     patterns += [(r'^' + self._params['url_name'] + '/edit$',
       
   149                   'soc.views.models.site.main_edit',
       
   150                   {'page_name': page_name}, page_name)]
       
   151     return patterns
       
   152 
   151 
   153 view = View()
   152 view = View()
   154 
   153 
   155 create = view.create
   154 create = view.create
   156 edit = view.edit
   155 edit = view.edit