registration_view: sorting of services, show all service data
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2084 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
4affa83236
commit
69af3d37cb
2 changed files with 15 additions and 6 deletions
|
@ -153,9 +153,13 @@ class CheckoutView(ServiceManagerView):
|
|||
regs = IClientRegistrations(client)
|
||||
instance = IInstance(client)
|
||||
data = instance.applyTemplate()
|
||||
data['service_registrations'] = regs.getRegistrations()
|
||||
data['service_registrations'] = sorted(regs.getRegistrations(),
|
||||
key=self.sortKey)
|
||||
return data
|
||||
|
||||
def sortKey(self, reg):
|
||||
return reg.service.start
|
||||
|
||||
def update(self):
|
||||
form = self.request.form
|
||||
clientName = self.getClientName()
|
||||
|
@ -261,7 +265,11 @@ class RegistrationTemplateView(BaseView):
|
|||
return self.getServices()
|
||||
|
||||
def getServices(self):
|
||||
return self.context.getServices().values()
|
||||
return self.context.getServices()
|
||||
#return sorted(self.context.getServices().values(), key=self.sortKey)
|
||||
|
||||
def sortKey(self, svc):
|
||||
return (svc.category, svc.getClassification(), svc.start)
|
||||
|
||||
def getRegistrations(self):
|
||||
clientName = self.getClientName()
|
||||
|
|
|
@ -97,6 +97,7 @@ class Service(object):
|
|||
|
||||
manager = None
|
||||
category = None
|
||||
location = ''
|
||||
allowRegWithNumber = False
|
||||
allowDirectRegistration = True
|
||||
|
||||
|
@ -246,10 +247,10 @@ class ClientRegistrations(object):
|
|||
def getRegistrations(self):
|
||||
# TODO: restrict to services on this template
|
||||
regs = getattr(self.context, self.registrationsAttributeName, [])
|
||||
if self.template is None:
|
||||
return regs
|
||||
svcs = self.template.getServices().values()
|
||||
return [r for r in regs if r.service in svcs]
|
||||
if self.template is not None:
|
||||
svcs = self.template.getServices().values()
|
||||
regs = (r for r in regs if r.service in svcs)
|
||||
return regs
|
||||
|
||||
|
||||
# registration states definition
|
||||
|
|
Loading…
Add table
Reference in a new issue