app/soc/views/models/document.py
changeset 512 aae25d2b4464
parent 507 3603fdafabf7
child 513 3c1e16637ad7
equal deleted inserted replaced
511:52557918ec8f 512:aae25d2b4464
    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', 'author', 'created', 'modified']
    55     exclude = ['inheritance_line', 'author', 'created', 'modified']
    56 
    56 
    57   def clean_partial_path(self):
    57   def clean_partial_path(self):
    58     partial_path = self.cleaned_data.get('partial_path')
    58     partial_path = self.cleaned_data.get('partial_path')
    59     # TODO(tlarsen): combine path and link_name and check for uniqueness
    59     # TODO(tlarsen): combine path and link_id and check for uniqueness
    60     if not validate.isPartialPathFormatValid(partial_path):
    60     if not validate.isPartialPathFormatValid(partial_path):
    61       raise forms.ValidationError("This partial path is in wrong format.")
    61       raise forms.ValidationError("This partial path is in wrong format.")
    62     return partial_path
    62     return partial_path
    63 
    63 
    64   def clean_link_name(self):
    64   def clean_link_id(self):
    65     link_name = self.cleaned_data.get('link_name')
    65     link_id = self.cleaned_data.get('link_id')
    66     # TODO(tlarsen): combine path and link_name and check for uniqueness
    66     # TODO(tlarsen): combine path and link_id and check for uniqueness
    67     if not validate.isLinkNameFormatValid(link_name):
    67     if not validate.isLinkIdFormatValid(link_id):
    68       raise forms.ValidationError("This link name is in wrong format.")
    68       raise forms.ValidationError("This link ID is in wrong format.")
    69     return link_name
    69     return link_id
    70 
    70 
    71 
    71 
    72 class EditForm(CreateForm):
    72 class EditForm(CreateForm):
    73   """Django form displayed a Document is edited.
    73   """Django form displayed a Document is edited.
    74   """
    74   """
   138 
   138 
   139   def _editGet(self, request, entity, form):
   139   def _editGet(self, request, entity, form):
   140     """See base.View._editGet().
   140     """See base.View._editGet().
   141     """
   141     """
   142 
   142 
   143     form.fields['created_by'].initial = entity.author.link_name
   143     form.fields['created_by'].initial = entity.author.link_id
   144     form.fields['doc_key_name'].initial = entity.key().name(),
   144     form.fields['doc_key_name'].initial = entity.key().name(),
   145 
   145 
   146 
   146 
   147 view = View()
   147 view = View()
   148 
   148