app/soc/views/models/document.py
author Sverre Rabbelier <srabbelier@gmail.com>
Thu, 20 Nov 2008 21:57:25 +0000
changeset 521 07b2c382a4d6
parent 514 55bd39dab49c
child 550 577dbfbeef97
permissions -rw-r--r--
Minor improvements to roles page Mainly not hard-coding the page name and showing all requests that are _accepted_, instead of the one's that aren't yet.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
#
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
#
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
476
3b0662786f95 Fixed typo in docstring
Sverre Rabbelier <srabbelier@gmail.com>
parents: 462
diff changeset
    17
"""Views for Documents.
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
"""
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
__authors__ = [
429
e50e18936f06 Fixed typo in e-mail address
Sverre Rabbelier <srabbelier@gmail.com>
parents: 408
diff changeset
    21
    '"Sverre Rabbelier" <sverre@rabbelier.nl>',
462
1f164cd0529b Adds a check to logic/valididate.py that checks the partial path format using a regexp. This regexp has been added to logic/path_link_name.py, therefore changing PATH_LINKNAME_REGEX to use the PARTIAL_PATH in building this regexp. Plus views/models/docs.py now uses the validation functions in the clean_ methods.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 448
diff changeset
    22
    '"Lennard de Rijk" <ljvderijk@gmail.com>',
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
    '"Pawel Solyga" <pawel.solyga@gmail.com>',
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
  ]
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
from google.appengine.api import users
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    28
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
from django import forms
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
from django.utils.translation import ugettext_lazy
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
from soc.logic import dicts
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
from soc.logic import validate
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
from soc.views import helper
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
from soc.views.helper import widgets
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
from soc.views.models import base
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
import soc.models.document
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
import soc.logic.models.document
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
import soc.logic.dicts
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
import soc.views.helper
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
import soc.views.helper.widgets
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
408
7cd6bdfbf95c Inherit from BaseForm in all forms instead of from DbModelForm. This change doesn't include changes to templates and usage of as_table everywhere (work in progress).
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 404
diff changeset
    44
class CreateForm(helper.forms.BaseForm):
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
  """Django form displayed when Developer creates a Document.
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
  """
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
  content = forms.fields.CharField(widget=helper.widgets.TinyMCE(
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
      attrs={'rows':10, 'cols':40}))
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
  class Meta:
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
    model = soc.models.document.Document
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    53
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54
    #: list of model fields which will *not* be gathered by the form
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    55
    exclude = ['inheritance_line', 'author', 'created', 'modified']
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    56
513
3c1e16637ad7 Rename partial_path to scope_path, ignoring case, etc.
Todd Larsen <tlarsen@google.com>
parents: 512
diff changeset
    57
  def clean_scope_path(self):
3c1e16637ad7 Rename partial_path to scope_path, ignoring case, etc.
Todd Larsen <tlarsen@google.com>
parents: 512
diff changeset
    58
    scope_path = self.cleaned_data.get('scope_path')
512
aae25d2b4464 Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
Todd Larsen <tlarsen@google.com>
parents: 507
diff changeset
    59
    # TODO(tlarsen): combine path and link_id and check for uniqueness
513
3c1e16637ad7 Rename partial_path to scope_path, ignoring case, etc.
Todd Larsen <tlarsen@google.com>
parents: 512
diff changeset
    60
    if not validate.isScopePathFormatValid(scope_path):
3c1e16637ad7 Rename partial_path to scope_path, ignoring case, etc.
Todd Larsen <tlarsen@google.com>
parents: 512
diff changeset
    61
      raise forms.ValidationError("This scope path is in wrong format.")
3c1e16637ad7 Rename partial_path to scope_path, ignoring case, etc.
Todd Larsen <tlarsen@google.com>
parents: 512
diff changeset
    62
    return scope_path
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    63
512
aae25d2b4464 Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
Todd Larsen <tlarsen@google.com>
parents: 507
diff changeset
    64
  def clean_link_id(self):
aae25d2b4464 Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
Todd Larsen <tlarsen@google.com>
parents: 507
diff changeset
    65
    link_id = self.cleaned_data.get('link_id')
aae25d2b4464 Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
Todd Larsen <tlarsen@google.com>
parents: 507
diff changeset
    66
    # TODO(tlarsen): combine path and link_id and check for uniqueness
aae25d2b4464 Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
Todd Larsen <tlarsen@google.com>
parents: 507
diff changeset
    67
    if not validate.isLinkIdFormatValid(link_id):
aae25d2b4464 Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
Todd Larsen <tlarsen@google.com>
parents: 507
diff changeset
    68
      raise forms.ValidationError("This link ID is in wrong format.")
aae25d2b4464 Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
Todd Larsen <tlarsen@google.com>
parents: 507
diff changeset
    69
    return link_id
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    70
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    71
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    72
class EditForm(CreateForm):
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    73
  """Django form displayed a Document is edited.
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    74
  """
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    75
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    76
  doc_key_name = forms.fields.CharField(widget=forms.HiddenInput)
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    77
  created_by = forms.fields.CharField(widget=helper.widgets.ReadOnlyInput(),
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    78
                                      required=False)
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    79
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    80
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    81
class View(base.View):
499
d22e4fe8e64b Fix missing dots in doc strings and some other doc string corrections.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 494
diff changeset
    82
  """View methods for the Document model.
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    83
  """
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    84
507
3603fdafabf7 Fold the _rights dictionary into params
Sverre Rabbelier <srabbelier@gmail.com>
parents: 502
diff changeset
    85
  def __init__(self, original_params=None):
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    86
    """Defines the fields and methods required for the base View class
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    87
    to provide the user with list, public, create, edit and delete views.
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    88
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    89
    Params:
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    90
      original_params: a dict with params for this View
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    91
    """
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    92
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    93
    self._logic = soc.logic.models.document.logic
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    94
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    95
    params = {}
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    96
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    97
    params['name'] = "Document"
477
8a8b1bd035c4 Moved from docs -> document
Sverre Rabbelier <srabbelier@gmail.com>
parents: 476
diff changeset
    98
    params['name_short'] = "Document"
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    99
    params['name_plural'] = "Documents"
502
e1e24c0a4e82 Add new parameters to views: url_name which is name used in urls (instead of using lower entity names) and module_name which is used for constructing django urls. Append changes to all affected files. Fix some title names. Change urls that included underscores like "site_settings" into urls with slash "site/settings". Plus some other minor fixes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 499
diff changeset
   100
    params['url_name'] = "document"
e1e24c0a4e82 Add new parameters to views: url_name which is name used in urls (instead of using lower entity names) and module_name which is used for constructing django urls. Append changes to all affected files. Fix some title names. Change urls that included underscores like "site_settings" into urls with slash "site/settings". Plus some other minor fixes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 499
diff changeset
   101
    params['module_name'] = "document"
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   102
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   103
    params['edit_form'] = EditForm
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   104
    params['create_form'] = CreateForm
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   105
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   106
    # TODO(tlarsen) Add support for Django style template lookup
445
31927f21970d Major site restructuring, also deleting of many unused or obsolete documents
Sverre Rabbelier <srabbelier@gmail.com>
parents: 429
diff changeset
   107
    params['edit_template'] = 'soc/models/edit.html'
477
8a8b1bd035c4 Moved from docs -> document
Sverre Rabbelier <srabbelier@gmail.com>
parents: 476
diff changeset
   108
    params['public_template'] = 'soc/document/public.html'
445
31927f21970d Major site restructuring, also deleting of many unused or obsolete documents
Sverre Rabbelier <srabbelier@gmail.com>
parents: 429
diff changeset
   109
    params['list_template'] = 'soc/models/list.html'
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   110
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   111
    params['lists_template'] = {
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   112
      'list_main': 'soc/list/list_main.html',
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   113
      'list_pagination': 'soc/list/list_pagination.html',
477
8a8b1bd035c4 Moved from docs -> document
Sverre Rabbelier <srabbelier@gmail.com>
parents: 476
diff changeset
   114
      'list_row': 'soc/document/list/docs_row.html',
8a8b1bd035c4 Moved from docs -> document
Sverre Rabbelier <srabbelier@gmail.com>
parents: 476
diff changeset
   115
      'list_heading': 'soc/document/list/docs_heading.html',
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   116
    }
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   117
502
e1e24c0a4e82 Add new parameters to views: url_name which is name used in urls (instead of using lower entity names) and module_name which is used for constructing django urls. Append changes to all affected files. Fix some title names. Change urls that included underscores like "site_settings" into urls with slash "site/settings". Plus some other minor fixes.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 499
diff changeset
   118
    params['delete_redirect'] = '/' + params['url_name'] + '/list'
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   119
507
3603fdafabf7 Fold the _rights dictionary into params
Sverre Rabbelier <srabbelier@gmail.com>
parents: 502
diff changeset
   120
    params = dicts.merge(original_params, params)
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   121
507
3603fdafabf7 Fold the _rights dictionary into params
Sverre Rabbelier <srabbelier@gmail.com>
parents: 502
diff changeset
   122
    base.View.__init__(self, params=params)
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   123
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   124
  def _editPost(self, request, entity, fields):
402
021e86368600 Incorperated suggestions by Todd
Sverre Rabbelier <srabbelier@gmail.com>
parents: 400
diff changeset
   125
    """See base.View._editPost().
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   126
    """
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   127
481
94834a1e6c01 Attempt to rename User.id to User.account, in preparation for making User be
Todd Larsen <tlarsen@google.com>
parents: 477
diff changeset
   128
    account = users.get_current_user()
94834a1e6c01 Attempt to rename User.id to User.account, in preparation for making User be
Todd Larsen <tlarsen@google.com>
parents: 477
diff changeset
   129
    user = soc.logic.models.user.logic.getForFields({'account': account},
94834a1e6c01 Attempt to rename User.id to User.account, in preparation for making User be
Todd Larsen <tlarsen@google.com>
parents: 477
diff changeset
   130
                                                    unique=True)
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   131
    fields['author'] = user
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   132
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   133
  def _editGet(self, request, entity, form):
402
021e86368600 Incorperated suggestions by Todd
Sverre Rabbelier <srabbelier@gmail.com>
parents: 400
diff changeset
   134
    """See base.View._editGet().
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   135
    """
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   136
512
aae25d2b4464 Rename link_name to link_id everywhere, regardless of case (so LINK_NAME
Todd Larsen <tlarsen@google.com>
parents: 507
diff changeset
   137
    form.fields['created_by'].initial = entity.author.link_id
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   138
    form.fields['doc_key_name'].initial = entity.key().name(),
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   139
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   140
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   141
view = View()
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   142
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   143
create = view.create
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   144
edit = view.edit
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   145
delete = view.delete
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   146
list = view.list
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   147
public = view.public