app/soc/views/models/host.py
changeset 409 9d24850db88f
parent 408 7cd6bdfbf95c
child 413 ec1b590418df
equal deleted inserted replaced
408:7cd6bdfbf95c 409:9d24850db88f
    20 __authors__ = [
    20 __authors__ = [
    21     '"Sverre Rabbelier" <sverer@rabbelier.nl>',
    21     '"Sverre Rabbelier" <sverer@rabbelier.nl>',
    22   ]
    22   ]
    23 
    23 
    24 
    24 
    25 from google.appengine.api import users
       
    26 
       
    27 from django import forms
       
    28 from django.utils.translation import ugettext_lazy
    25 from django.utils.translation import ugettext_lazy
    29 
    26 
    30 from soc.logic import dicts
    27 from soc.logic import dicts
    31 from soc.logic import validate
       
    32 from soc.views import helper
    28 from soc.views import helper
    33 from soc.views.helper import widgets
       
    34 from soc.views.models import base
    29 from soc.views.models import base
    35 
    30 
    36 import soc.models.host
    31 import soc.models.host
    37 import soc.logic.models.host
    32 import soc.logic.models.host
    38 import soc.logic.dicts
       
    39 import soc.views.helper
    33 import soc.views.helper
    40 import soc.views.helper.widgets
       
    41 
    34 
    42 
    35 
    43 class CreateForm(helper.forms.BaseForm):
    36 class CreateForm(helper.forms.BaseForm):
    44   """Django form displayed when creating a Host.
    37   """Django form displayed when creating a Host.
    45   """
    38   """
   100     params['edit_form'] = EditForm
    93     params['edit_form'] = EditForm
   101     params['create_form'] = CreateForm
    94     params['create_form'] = CreateForm
   102 
    95 
   103     # TODO(tlarsen) Add support for Django style template lookup
    96     # TODO(tlarsen) Add support for Django style template lookup
   104     params['edit_template'] = 'soc/models/edit.html'
    97     params['edit_template'] = 'soc/models/edit.html'
   105     params['public_template'] = 'soc/models/public.html'
    98     params['public_template'] = 'soc/host/public.html'
   106     params['list_template'] = 'soc/list/all.html'
    99     params['list_template'] = 'soc/list/all.html'
   107 
   100 
   108     params['lists_template'] = {
   101     params['lists_template'] = {
   109       'list_main': 'soc/list/list_main.html',
   102       'list_main': 'soc/list/list_main.html',
   110       'list_pagination': 'soc/list/list_pagination.html',
   103       'list_pagination': 'soc/list/list_pagination.html',
   128     rights = dicts.merge(original_rights, rights)
   121     rights = dicts.merge(original_rights, rights)
   129 
   122 
   130     base.View.__init__(self, rights=rights, params=params)
   123     base.View.__init__(self, rights=rights, params=params)
   131 
   124 
   132   def _editPost(self, request, entity, fields):
   125   def _editPost(self, request, entity, fields):
   133     """
   126     """See base.View._editPost().
   134     """
   127     """
   135 
   128 
   136     fields['sponsor_ln'] = fields['sponsor'].link_name
   129     fields['sponsor_ln'] = fields['sponsor'].link_name
   137     fields['user_ln'] = fields['user'].link_name
   130     fields['user_ln'] = fields['user'].link_name
   138 
   131