Skip to content

Instantly share code, notes, and snippets.

@GerardLutterop
Last active September 16, 2015 11:16
Show Gist options
  • Save GerardLutterop/0f600fbaf9ef49898952 to your computer and use it in GitHub Desktop.
Save GerardLutterop/0f600fbaf9ef49898952 to your computer and use it in GitHub Desktop.
json
@view_config(route_name='appointment_by_code', renderer='templates/index.jinja2', request_method='GET')
def appointment_by_code(self):
"""Landingspage for the user to show available time slots and process the user's choice."""
log.debug('appointment_by_code')
request = self.request
code = request.matchdict.get('code')
cust = request.db.get_customer_by_code(code)
if not cust:
request.session['header'] = 'Klant onbekend'
request.session['message'] = 'Het opgegeven klantnummer is niet gevonden.'
raise HTTPFound(request.route_url('message'))
if request.db.get_appointments(cust.get('customer_number')):
return HTTPFound(request.route_url('make-appointment'))
request.session['code'] = code
weeks = request.db.get_timeslots_by_code(code)
return self.display_weeks(weeks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment