Beispiel #1
0
 def render_template_with_context(self):
     template_name = self.get_template()
     # if context and isinstance(context, dict):
     #     self.context = context
     # else:
     #     self.context = self.get_context_data()
     self.context = self.get_context_data()
     context = self.context if self.context else {}
     return '200 OK', render(template_name, **context)
Beispiel #2
0
    def __call__(self, request):
        request_params = request['request_params']

        try:
            item_id = int(request_params['item_id'])
            cat_id = int(request_params['cat_id'])
            cat_name = request_params['cat_name']
            mapper = MapperRegistry.get_current_mapper('course')
            old_course = mapper.find_by_id(item_id)
            new_name = f'copy_{old_course.name}'
            new_course = old_course.clone()
            new_course.name = new_name
            new_course.mark_new()
            UnitOfWork.get_current().commit()
            courses = mapper.find_by_field('category_id', cat_id)

            return '200 OK', render('course_list.html',
                                    objects_list=courses,
                                    category_name=cat_name,
                                    id=cat_id)

        except KeyError:
            return '200 OK', 'No courses have been added yet'
Beispiel #3
0
 def __call__(self, request):
     return '200 OK', render('study-programs.html',
                             data=request.get('date', None))
Beispiel #4
0
 def __call__(self, request):
     return '200 OK', render('feedback.html',
                             date=request.get('date', None))
Beispiel #5
0
 def __call__(self, request):
     return '200 OK', render('registration.html',
                             date=request.get('date', None))
Beispiel #6
0
 def __call__(self, request):
     return '200 OK', render('about.html')