Beispiel #1
0
 def post(self, *args, **kwargs):
     self.delete_many()
     clear_cache()
     parser = Parser()
     articles = []
     for page in parser:
         articles.append(self.create(*page))
     return jsonify({'data': render_template('articles.html', articles=articles)})
Beispiel #2
0
 def get(self, *args, **kwargs):
     article = self.get_id(kwargs['id'])
     if not article:
         abort(404)
     return render_template('detail.html', article=article)
Beispiel #3
0
 def get_template(self, context):
     if self.extra_context: context.update(self.extra_context)
     template = render_template(self.template_name, **context)
     return template
Beispiel #4
0
 def get(self, *args, **kwargs):
     articles = self.get_many()
     return render_template('index.html', articles=articles)
Beispiel #5
0
 def page_not_found(e):
     current_app.logger.error(str(e))
     return (render_template('errors/404.html'), 404)