def piece_create(): form = PieceForm() if form.validate_on_submit(): piece_db = Piece( lesson = form.lesson.data, section = form.section.data, tag = form.tag.data, number = form.number.data, content = form.content.data, ) try: piece_db.put() flash(u'Piece id %s successfully saved.' % piece_db.key.id(), 'success') return redirect(url_for('piece_view')) except: flash(u'Something went wrong.', 'info') return redirect(url_for('piece_update')) return render_template( 'piece_update.html', html_class='piece-create', title='Create Piece', form=form)
def setup(self, game): game.turn = 1 game.phase = 1 game.luftwaffe = 3 game.vp = 0 game.initiative = 0 game.axis_armor_track = 0 game.eliminated_panzer_units = 0 game.axis_strategic_mode = 'tank-production' game.soviet_armor_track = 0 game.soviet_industry_track = 0 game.soviet_lend_lease_track = 0 game.fortified = self.fortified # eventually I'll have a proper setup but I need to do some actual # game-code work for a change...so we'll just go with a hard-coded setup # for now #game.state = 'setup' game.state = 'playing' for ussr in self.ussr_line: p = Piece(game=game, side='ussr', type='line', y=ussr[0], x=ussr[1]) p.put() for finn in self.finns: p = Piece(game=game, side='axis', type='finn', y=finn[0], x=finn[1]) p.put() Piece(game=game, side='axis', type='panzer', y=6, x=5).put() Piece(game=game, side='axis', type='panzer', y=8, x=5).put() Piece(game=game, side='axis', type='panzer', y=9, x=5).put() Piece(game=game, side='axis', type='mountain', y=11, x=7).put() Piece(game=game, side='axis', type='rumanian', y=11, x=6).put() Piece(game=game, side='axis', type='rumanian', y=12, x=8).put() for german in itertools.chain(self.greater_germany_setup, [[11, 5]]): p = Piece(game=game, side='axis', type='line', y=german[0], x=german[1]) p.put()