def query_by_reg_user_id(self, reg_id, user, status='all'): logger.info('NdbEventDao:: DBHIT: query_by_reg_user_id for %s %s' % (reg_id, user.key)) reg_query = Register.query(ndb.AND(Register.reg_id == reg_id, Register.user_id == user.key )) if status != 'all': status_value = STATUS_DICT.get(status) reg_query = reg_query.filter(status == status_value) register = reg_query.fetch(1) return register[0] if register is not None and len(register) > 0 else None
def register_examples(): """List register examples""" register = Register.query() form = RegisterForm() if form.validate_on_submit(): register = Register( rsvp=form.rsvp.data, donation=form.donation.data, user_id=users.get_current_user() ) try: register.put() register_id = register.key.id() flash(u'Example %s successfully saved.' % register_id, 'success') return redirect(url_for('register_examples')) except CapabilityDisabledError: flash(u'App Engine Datastore is currently in read-only mode.', 'info') return redirect(url_for('register_examples')) return render_template('register_gae.html', register=register, form=form)
def get(self): msg = Register.query().fetch() saved = {"msg": msg} return self.render_template("save.html", saved)
def query_by_user(self, user): logger.info('NdbRegisterDao:: DBHIT: get_all_record ') reg_query = Register.query(Register.status == True, Register.user_id == user.key) return reg_query.fetch()
def get(self): msg = Register.query().fetch() output = {"msg": msg} return self.render_template("messages.html", output)