def add(self): c.form = DictionaryForm(request.POST) if request.method == 'POST' and c.form.validate(): entry = Dictionary() c.form.populate_obj(entry, exclude=['id']) try: entry.save() flash(u'Dodano nowe pole.') return self.redirect(url(controller='dictionary', action='list')) except DictionaryExistsException: flash(u'Podany klucz i wartość już istnieją.') return render('/dictionaries/add.xhtml')