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)
|
regs = IClientRegistrations(client)
|
||||||
instance = IInstance(client)
|
instance = IInstance(client)
|
||||||
data = instance.applyTemplate()
|
data = instance.applyTemplate()
|
||||||
data['service_registrations'] = regs.getRegistrations()
|
data['service_registrations'] = sorted(regs.getRegistrations(),
|
||||||
|
key=self.sortKey)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def sortKey(self, reg):
|
||||||
|
return reg.service.start
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
form = self.request.form
|
form = self.request.form
|
||||||
clientName = self.getClientName()
|
clientName = self.getClientName()
|
||||||
|
@ -261,7 +265,11 @@ class RegistrationTemplateView(BaseView):
|
||||||
return self.getServices()
|
return self.getServices()
|
||||||
|
|
||||||
def getServices(self):
|
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):
|
def getRegistrations(self):
|
||||||
clientName = self.getClientName()
|
clientName = self.getClientName()
|
||||||
|
|
|
@ -97,6 +97,7 @@ class Service(object):
|
||||||
|
|
||||||
manager = None
|
manager = None
|
||||||
category = None
|
category = None
|
||||||
|
location = ''
|
||||||
allowRegWithNumber = False
|
allowRegWithNumber = False
|
||||||
allowDirectRegistration = True
|
allowDirectRegistration = True
|
||||||
|
|
||||||
|
@ -246,10 +247,10 @@ class ClientRegistrations(object):
|
||||||
def getRegistrations(self):
|
def getRegistrations(self):
|
||||||
# TODO: restrict to services on this template
|
# TODO: restrict to services on this template
|
||||||
regs = getattr(self.context, self.registrationsAttributeName, [])
|
regs = getattr(self.context, self.registrationsAttributeName, [])
|
||||||
if self.template is None:
|
if self.template is not None:
|
||||||
return regs
|
svcs = self.template.getServices().values()
|
||||||
svcs = self.template.getServices().values()
|
regs = (r for r in regs if r.service in svcs)
|
||||||
return [r for r in regs if r.service in svcs]
|
return regs
|
||||||
|
|
||||||
|
|
||||||
# registration states definition
|
# registration states definition
|
||||||
|
|
Loading…
Add table
Reference in a new issue