app/soc/views/models/host.py
author Sverre Rabbelier <srabbelier@gmail.com>
Wed, 07 Jan 2009 21:57:12 +0000
changeset 776 f86a76f52bf4
parent 755 1ed041c0cdc6
child 799 30a912906a57
permissions -rw-r--r--
Started on edit timeline Added a gsoc timeline logic module. Also added a scope_path as the key_field to timeline. Updated the django_paterns to only include the edit field and removed link_id as dynafield. Patch by: Sverre Rabbelier
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
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    17
"""Views for Host profiles.
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: 413
diff changeset
    21
    '"Sverre Rabbelier" <sverre@rabbelier.nl>',
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
  ]
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
725
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
    25
from soc.logic import accounts
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
from soc.logic import dicts
725
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
    27
from soc.logic.models import host as host_logic
575
ba4a7e90139d Fix Host invites
Sverre Rabbelier <srabbelier@gmail.com>
parents: 569
diff changeset
    28
from soc.logic.models import user as user_logic
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
from soc.views import helper
494
5e9c656a1b68 Refactored SiteMap to be generic
Sverre Rabbelier <srabbelier@gmail.com>
parents: 493
diff changeset
    30
from soc.views.models import role
662
0e89b027b140 Make use of the new generic key_name by lookup up scope_path
Sverre Rabbelier <srabbelier@gmail.com>
parents: 657
diff changeset
    31
from soc.views.models import sponsor as sponsor_view
617
9cc42981d40a Now invited users can create a new Host profile
Sverre Rabbelier <srabbelier@gmail.com>
parents: 616
diff changeset
    32
from soc.views.helper import access
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    34
import soc.models.host
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    35
import soc.logic.models.host
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
import soc.views.helper
560
a32be584ee04 Requests are almost working now
Sverre Rabbelier <srabbelier@gmail.com>
parents: 554
diff changeset
    37
import soc.views.models.sponsor
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
744
cd9bf163473c Add missing dots, fix imports sorting and too long lines in different modules. Add TODO in soc.views.models.host module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 725
diff changeset
    39
# TODO(pawel.solyga): Rename all list methods and functions to something else
cd9bf163473c Add missing dots, fix imports sorting and too long lines in different modules. Add TODO in soc.views.models.host module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 725
diff changeset
    40
# and remove this tolist assignment
725
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
    41
tolist = list
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
    42
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
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: 406
diff changeset
    44
class CreateForm(helper.forms.BaseForm):
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    45
  """Django form displayed when creating a Host.
400
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
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    48
  class Meta:
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    49
    """Inner Meta class that defines some behavior for the form.
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    50
    """
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    51
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    52
    #: db.Model subclass for which the form will gather information
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    53
    model = soc.models.host.Host
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    55
    #: list of model fields which will *not* be gathered by the form
575
ba4a7e90139d Fix Host invites
Sverre Rabbelier <srabbelier@gmail.com>
parents: 569
diff changeset
    56
    exclude = ['scope', 'user']
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    57
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    58
  def clean_empty(self, field):
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    59
    data = self.cleaned_data.get(field)
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    60
    if not data or data == u'':
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    61
      return None
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    62
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    63
    return data
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    64
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    65
  def clean_home_page(self):
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    66
    return self.clean_empty('home_page')
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    67
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    68
  def clean_blog(self):
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    69
    return self.clean_empty('blog')
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    70
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    71
  def clean_photo_url(self):
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    72
    return self.clean_empty('photo_url')
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    73
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
class EditForm(CreateForm):
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
    76
  """Django form displayed when editing a Host.
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    77
  """
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    78
431
96b6ee5efdc3 Added a missing 'pass' statement
Sverre Rabbelier <srabbelier@gmail.com>
parents: 429
diff changeset
    79
  pass
96b6ee5efdc3 Added a missing 'pass' statement
Sverre Rabbelier <srabbelier@gmail.com>
parents: 429
diff changeset
    80
657
c781de4f6d39 Rename role.RoleView to role.View
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
    81
class View(role.View):
499
d22e4fe8e64b Fix missing dots in doc strings and some other doc string corrections.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 497
diff changeset
    82
  """View methods for the Host 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
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
    85
  def __init__(self, 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:
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
    90
      params: a dict with params for this View
400
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
617
9cc42981d40a Now invited users can create a new Host profile
Sverre Rabbelier <srabbelier@gmail.com>
parents: 616
diff changeset
    93
    rights = {}
710
edb5dbb1dea7 Add explicit access_types from the url
Sverre Rabbelier <srabbelier@gmail.com>
parents: 671
diff changeset
    94
    rights['create'] = [access.checkIsHost]
edb5dbb1dea7 Add explicit access_types from the url
Sverre Rabbelier <srabbelier@gmail.com>
parents: 671
diff changeset
    95
    rights['edit'] = [access.checkIsHost]
725
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
    96
    rights['list'] = [access.checkIsHost]
617
9cc42981d40a Now invited users can create a new Host profile
Sverre Rabbelier <srabbelier@gmail.com>
parents: 616
diff changeset
    97
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
    98
    new_params = {}
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
    99
    new_params['rights'] = rights
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
   100
    new_params['logic'] = soc.logic.models.host.logic
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   101
662
0e89b027b140 Make use of the new generic key_name by lookup up scope_path
Sverre Rabbelier <srabbelier@gmail.com>
parents: 657
diff changeset
   102
    new_params['scope_view'] = sponsor_view
0e89b027b140 Make use of the new generic key_name by lookup up scope_path
Sverre Rabbelier <srabbelier@gmail.com>
parents: 657
diff changeset
   103
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
   104
    new_params['logic'] = soc.logic.models.host.logic
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
   105
    new_params['group_view'] = soc.views.models.sponsor.view
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
   106
    new_params['invite_filter'] = {'group_ln': 'link_id'}
495
87afae6e4c51 Added basic 'invite' functionality
Sverre Rabbelier <srabbelier@gmail.com>
parents: 494
diff changeset
   107
716
26dc12dae79f Changed "Sponsor" to "Program Owner"
Lennard de Rijk <ljvderijk@gmail.com>
parents: 710
diff changeset
   108
    new_params['name'] = "Program Administrator"
26dc12dae79f Changed "Sponsor" to "Program Owner"
Lennard de Rijk <ljvderijk@gmail.com>
parents: 710
diff changeset
   109
    new_params['name_short'] = "Program Administrator"
26dc12dae79f Changed "Sponsor" to "Program Owner"
Lennard de Rijk <ljvderijk@gmail.com>
parents: 710
diff changeset
   110
    new_params['name_plural'] = "Program Administrators"
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
   111
    new_params['url_name'] = "host"
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
   112
    new_params['module_name'] = "host"
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   113
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
   114
    new_params['edit_form'] = EditForm
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
   115
    new_params['create_form'] = CreateForm
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   116
656
a76f1b443ea4 Cleanups in the views module
Sverre Rabbelier <srabbelier@gmail.com>
parents: 642
diff changeset
   117
    params = dicts.merge(params, new_params)
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   118
657
c781de4f6d39 Rename role.RoleView to role.View
Sverre Rabbelier <srabbelier@gmail.com>
parents: 656
diff changeset
   119
    super(View, self).__init__(params=params)
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   120
744
cd9bf163473c Add missing dots, fix imports sorting and too long lines in different modules. Add TODO in soc.views.models.host module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 725
diff changeset
   121
  def list(self, request, access_type, page_name=None, 
cd9bf163473c Add missing dots, fix imports sorting and too long lines in different modules. Add TODO in soc.views.models.host module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 725
diff changeset
   122
           params=None, filter=None):
cd9bf163473c Add missing dots, fix imports sorting and too long lines in different modules. Add TODO in soc.views.models.host module.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 725
diff changeset
   123
    """See base.View.list.
725
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   124
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   125
    Passes a filter to base.View.list so that only hosts from a sponsor
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   126
    that this user is host for are listed.
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   127
    """
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   128
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   129
    user = user_logic.logic.getForCurrentAccount()
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   130
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   131
    # Don't bother looking up everything if there's no user
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   132
    if user and (not accounts.isDeveloper(user=user)):
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   133
      hosts = host_logic.logic.getForFields({'user': user})
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   134
      sponsors = tolist((host.scope for host in hosts))
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   135
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   136
      new_filter = {'scope': sponsors}
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   137
      filter = dicts.merge(filter, new_filter)
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   138
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   139
    return super(View, self).list(request, access_type, page_name=page_name,
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   140
                                  params=params, filter=filter)
6180b32d990f Filter the "list Hosts" view
Sverre Rabbelier <srabbelier@gmail.com>
parents: 716
diff changeset
   141
575
ba4a7e90139d Fix Host invites
Sverre Rabbelier <srabbelier@gmail.com>
parents: 569
diff changeset
   142
  def _editPost(self, request, entity, fields):
ba4a7e90139d Fix Host invites
Sverre Rabbelier <srabbelier@gmail.com>
parents: 569
diff changeset
   143
    """See base.View._editPost().
ba4a7e90139d Fix Host invites
Sverre Rabbelier <srabbelier@gmail.com>
parents: 569
diff changeset
   144
    """
ba4a7e90139d Fix Host invites
Sverre Rabbelier <srabbelier@gmail.com>
parents: 569
diff changeset
   145
662
0e89b027b140 Make use of the new generic key_name by lookup up scope_path
Sverre Rabbelier <srabbelier@gmail.com>
parents: 657
diff changeset
   146
    user = user_logic.logic.getFromKeyName(fields['link_id'])
575
ba4a7e90139d Fix Host invites
Sverre Rabbelier <srabbelier@gmail.com>
parents: 569
diff changeset
   147
    fields['user'] = user
ba4a7e90139d Fix Host invites
Sverre Rabbelier <srabbelier@gmail.com>
parents: 569
diff changeset
   148
662
0e89b027b140 Make use of the new generic key_name by lookup up scope_path
Sverre Rabbelier <srabbelier@gmail.com>
parents: 657
diff changeset
   149
    super(View, self)._editPost(request, entity, fields)
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   150
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   151
view = View()
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   152
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   153
create = view.create
404
44223e50e1fc Added a Host profile and generalized some views
Sverre Rabbelier <srabbelier@gmail.com>
parents: 402
diff changeset
   154
delete = view.delete
400
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   155
edit = view.edit
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   156
list = view.list
8f07048d84ef Added a generic version of the Document views
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
   157
public = view.public
497
73666a7cd718 Added a default _editSeed method
Sverre Rabbelier <srabbelier@gmail.com>
parents: 495
diff changeset
   158
invite = view.invite