Ejemplo n.º 1
0
 def get(self, *args, **kwargs):
     # stu=Student("Rose",50)
     # stu.save()
     # self.write("ok")
     students = Student.all()
     print(students)
     self.render("students.html", students=students)
Ejemplo n.º 2
0
 def get(self):
     logging.info('starting batch insert job')
     users = Student.all().filter("auto =", True).order("-lastrun").fetch(limit=1000)
     for user in users:
         if user.calendar_id:
             try:
                 event_list = bseu_schedule.fetch_and_parse_week(user)
             except Exception, e:
                 logging.error(e)
             else:
                 if event_list:
                     create_calendar_events(user, event_list)
                     mailer.send(recipient=user.student.email(), params={'user': user.student, 'events': event_list})
Ejemplo n.º 3
0
    def get(self):
        '''This function is called when GET request is routed to this handler.

        '''
        #Retrieve all Student entities from datastore
        #Remember, this returns so-called cursor, not a list of entities
        students = Student.all()
        #Loading template
        tpl = jinja2_env.get_template('main.html')
        #Creating the context, which will be used to fill template
        render_context = {'students': students} if students.count() != 0 else {}
        #Rendering template
        result = tpl.render(render_context)
        #Sending response
        self.response.write(result)
Ejemplo n.º 4
0
    def get(self):
        '''This function is called when GET request is routed to this handler.

        '''
        #Retrieve all Student entities from datastore
        #Remember, this returns so-called cursor, not a list of entities
        students = Student.all()
        #Loading template
        tpl = jinja2_env.get_template('main.html')
        #Creating the context, which will be used to fill template
        render_context = {
            'students': students
        } if students.count() != 0 else {}
        #Rendering template
        result = tpl.render(render_context)
        #Sending response
        self.response.write(result)
Ejemplo n.º 5
0
def get_user_context():
    session = get_current_session()
    context = _get_common_context()

    student = Student.all().filter("student =", users.get_current_user()).order("-lastrun").get()

    if student:
        context['student'] = student
        context['link_key'] = add_permalink_and_get_key(student.group,
                                                        student.faculty,
                                                        student.form,
                                                        student.course)
        # replace to apply table styles
        context['schedule'] = {'week': bseu_schedule.fetch_and_show_week(student),
                               'semester': bseu_schedule.fetch_and_show_semester(student)}

    if session.has_key('calendars'):
        context['calendar'] = {'picker': session['calendars']}
        del session['calendars']

    return context
Ejemplo n.º 6
0
def increment_course_and_cleanup_graduates():
    for student in Student.all().run():
        _increment_or_delete(student)

    for link in PermanentLinks.all().run():
        _increment_or_delete(link)
Ejemplo n.º 7
0
def increment_course_and_cleanup_graduates():
    for student in Student.all().run():
        _increment_or_delete(student)

    for link in PermanentLinks.all().run():
        _increment_or_delete(link)
Ejemplo n.º 8
0
async def read():
	return await StudentBaseOut.from_queryset(Student.all())
Ejemplo n.º 9
0
 def get(self):
     user = Student.all().filter("student =", users.get_current_user()).order("-lastrun").get()
     create_calendar_events(user, bseu_schedule.fetch_and_parse_week(user))
     self.session = get_current_session()
     self.session['messages'] = ["Импорт успешен!"]
     self.redirect('/')