app/soc/views/models/user.py
changeset 502 e1e24c0a4e82
parent 500 44ea4620c5c0
child 507 3603fdafabf7
equal deleted inserted replaced
501:be89bf307478 502:e1e24c0a4e82
   125     rights = {}
   125     rights = {}
   126 
   126 
   127     params['name'] = "User"
   127     params['name'] = "User"
   128     params['name_short'] = "User"
   128     params['name_short'] = "User"
   129     params['name_plural'] = "Users"
   129     params['name_plural'] = "Users"
       
   130     params['url_name'] = "user"
       
   131     params['module_name'] = "user"
   130 
   132 
   131     params['edit_form'] = EditForm
   133     params['edit_form'] = EditForm
   132     params['create_form'] = CreateForm
   134     params['create_form'] = CreateForm
   133 
   135 
   134     # TODO(tlarsen) Add support for Django style template lookup
   136     # TODO(tlarsen) Add support for Django style template lookup
   141       'list_pagination': 'soc/list/list_pagination.html',
   143       'list_pagination': 'soc/list/list_pagination.html',
   142       'list_row': 'soc/user/list/user_row.html',
   144       'list_row': 'soc/user/list/user_row.html',
   143       'list_heading': 'soc/user/list/user_heading.html',
   145       'list_heading': 'soc/user/list/user_heading.html',
   144     }
   146     }
   145 
   147 
   146     params['delete_redirect'] = '/user/list'
   148     params['delete_redirect'] = '/' + params['url_name'] + '/list'
   147 
   149 
   148     params['save_message'] = [ugettext_lazy('Profile saved.')]
   150     params['save_message'] = [ugettext_lazy('Profile saved.')]
   149 
   151 
   150     params['edit_params'] = {
   152     params['edit_params'] = {
   151         self.DEF_SUBMIT_MSG_PARAM_NAME: self.DEF_SUBMIT_MSG_PROFILE_SAVED,
   153         self.DEF_SUBMIT_MSG_PARAM_NAME: self.DEF_SUBMIT_MSG_PROFILE_SAVED,
   197     """
   199     """
   198 
   200 
   199     params = {}
   201     params = {}
   200     params['name'] = "User (self)"
   202     params['name'] = "User (self)"
   201     params['sidebar'] = [
   203     params['sidebar'] = [
   202         ('/user/edit', 'Profile'),
   204         ('/' + self._params['url_name'] + '/edit', 'Profile'),
   203         ('/roles/list', 'Roles'),
   205         ('/' + self._params['url_name'] + '/roles', 'Roles'),
   204         ]
   206         ]
   205     return self.getSidebarLinks(params)
   207     return self.getSidebarLinks(params)
   206 
   208 
   207   def getDjangoURLPatterns(self):
   209   def getDjangoURLPatterns(self):
   208     """See base.View.getDjangoURLPatterns().
   210     """See base.View.getDjangoURLPatterns().
   209     """
   211     """
   210 
   212 
   211     patterns = super(View, self).getDjangoURLPatterns()
   213     patterns = super(View, self).getDjangoURLPatterns()
   212     patterns += [(r'^user/edit$','soc.views.user.profile.create')]
   214     patterns += [(r'^' + self._params['url_name'] + '/edit$','soc.views.user.profile.create')]
   213     return patterns
   215     return patterns
   214 
   216 
   215 
   217 
   216 view = View()
   218 view = View()
   217 
   219