app/soc/views/models/comment.py
changeset 1687 8203c805edc7
parent 1678 80411f57f31a
child 1769 7596a1d31723
equal deleted inserted replaced
1686:d9cc9f8ca19f 1687:8203c805edc7
    89                                              required=False),
    89                                              required=False),
    90         'content': forms.fields.CharField(
    90         'content': forms.fields.CharField(
    91             widget=helper.widgets.TinyMCE(attrs={'rows':10, 'cols':40})),
    91             widget=helper.widgets.TinyMCE(attrs={'rows':10, 'cols':40})),
    92         'scope_path': forms.CharField(widget=forms.HiddenInput, required=True),
    92         'scope_path': forms.CharField(widget=forms.HiddenInput, required=True),
    93         }
    93         }
    94     new_params['extra_dynaexclude'] = ['author', 'commented', 'link_id', 'modified_by']
    94     new_params['extra_dynaexclude'] = ['author', 'link_id', 'modified_by']
    95 
    95 
    96     new_params['edit_extra_dynaproperties'] = {
    96     new_params['edit_extra_dynaproperties'] = {
    97         'link_id': forms.CharField(widget=forms.HiddenInput, required=True),
    97         'link_id': forms.CharField(widget=forms.HiddenInput, required=True),
    98         'created_by': forms.fields.CharField(widget=helper.widgets.ReadOnlyInput(),
    98         'created_by': forms.fields.CharField(widget=helper.widgets.ReadOnlyInput(),
    99                                              required=False),
    99                                              required=False),
   107     """
   107     """
   108 
   108 
   109     entity = context['entity']
   109     entity = context['entity']
   110 
   110 
   111     if entity:
   111     if entity:
   112       on = entity.commented
   112       on = entity.scope
   113     else:
   113     else:
   114       seed = context['seed']
   114       seed = context['seed']
   115       on =  seed['commented']
   115       on =  seed['commented']
   116 
   116 
   117     params = {'url_name': self._params['comment_on_url_name']}
   117     params = {'url_name': self._params['comment_on_url_name']}
   143   def _editGet(self, request, entity, form):
   143   def _editGet(self, request, entity, form):
   144     """See base.View._editGet().
   144     """See base.View._editGet().
   145     """
   145     """
   146 
   146 
   147     form.fields['created_by'].initial = entity.author.name
   147     form.fields['created_by'].initial = entity.author.name
   148     form.fields['on'].initial = entity.commented.name
   148     form.fields['on'].initial = entity.scope.name
   149     form.fields['link_id'].initial = entity.link_id
   149     form.fields['link_id'].initial = entity.link_id
   150     form.fields['scope_path'].initial = entity.scope_path
   150     form.fields['scope_path'].initial = entity.scope_path
   151 
   151 
   152     super(View, self)._editGet(request, entity, form)
   152     super(View, self)._editGet(request, entity, form)
   153 
   153