Exemplo n.º 1
0
 def generate_contest(self):
     return ContestModel.create_contest(
         title=self.title.data,
         contest_type=self.contest_type.data,
         password=self.password.data,
         start_at=self.start_at.data,
         end_at=self.end_at.data,
         description=self.description.data
     )
Exemplo n.º 2
0
 def get(self):
     per_page = current_app.config['CONTEST_PER_PAGE']
     page = request.args.get('page', 1, type=int)
     paginate = ContestModel.objects(
         start_at__lt=datetime.now(),
         end_at__gt=datetime.now()
     ).order_by('-start_at').paginate(page=page, per_page=per_page)
     contests = paginate.items
     return render_template(
         self.template,
         contests=contests,
         paginate=paginate
     )