app/soc/views/models/home_settings.py
changeset 512 aae25d2b4464
parent 507 3603fdafabf7
child 513 3c1e16637ad7
equal deleted inserted replaced
511:52557918ec8f 512:aae25d2b4464
    55       help_text=soc.models.work.Work.partial_path.help_text)
    55       help_text=soc.models.work.Work.partial_path.help_text)
    56 
    56 
    57   # TODO(tlarsen): actually, using these two text fields to specify
    57   # TODO(tlarsen): actually, using these two text fields to specify
    58   #   the Document is pretty cheesy; this needs to be some much better
    58   #   the Document is pretty cheesy; this needs to be some much better
    59   #   Role-scoped Document selector that we don't have yet
    59   #   Role-scoped Document selector that we don't have yet
    60   doc_link_name = forms.CharField(required=False,
    60   doc_link_id = forms.CharField(required=False,
    61       label=ugettext_lazy('Document link name'),
    61       label=ugettext_lazy('Document link ID'),
    62       help_text=soc.models.work.Work.link_name.help_text)
    62       help_text=soc.models.work.Work.link_id.help_text)
    63 
    63 
    64   def clean_feed_url(self):
    64   def clean_feed_url(self):
    65     feed_url = self.cleaned_data.get('feed_url')
    65     feed_url = self.cleaned_data.get('feed_url')
    66 
    66 
    67     if feed_url == '':
    67     if feed_url == '':
   165     """
   165     """
   166 
   166 
   167     try:
   167     try:
   168       if entity.home:
   168       if entity.home:
   169         form.fields['doc_partial_path'].initial = entity.home.partial_path
   169         form.fields['doc_partial_path'].initial = entity.home.partial_path
   170         form.fields['doc_link_name'].initial = entity.home.link_name
   170         form.fields['doc_link_id'].initial = entity.home.link_id
   171     except db.Error:
   171     except db.Error:
   172       pass
   172       pass
   173 
   173 
   174   def _editPost(self, request, entity, fields):
   174   def _editPost(self, request, entity, fields):
   175     """See base.View._editPost().
   175     """See base.View._editPost().
   176     """
   176     """
   177 
   177 
   178     doc_partial_path = fields['doc_partial_path']
   178     doc_partial_path = fields['doc_partial_path']
   179     doc_link_name = fields['doc_link_name']
   179     doc_link_id = fields['doc_link_id']
   180 
   180 
   181     # TODO notify the user if home_doc is not found
   181     # TODO notify the user if home_doc is not found
   182     home_doc = document_logic.logic.getFromFields(
   182     home_doc = document_logic.logic.getFromFields(
   183     partial_path=doc_partial_path, link_name=doc_link_name)
   183     partial_path=doc_partial_path, link_id=doc_link_id)
   184 
   184 
   185     fields['home'] = home_doc
   185     fields['home'] = home_doc
   186 
   186 
   187 
   187 
   188 view = View()
   188 view = View()