google-app-engine


Google App Engine + Validation


I am looking for how to do validation on Google App Engine and I have found only how to do it using Django framework. Ok Django approach is ok but if I have one form and this form have data from few tables what then???
I can not do it like this:
class Item(db.Model):
name = db.StringProperty()
quantity = db.IntegerProperty(default=1)
target_price = db.FloatProperty()
priority = db.StringProperty(default='Medium',choices=[
'High', 'Medium', 'Low'])
entry_time = db.DateTimeProperty(auto_now_add=True)
added_by = db.UserProperty()
class ItemForm(djangoforms.ModelForm):
class Meta:
model = Item
exclude = ['added_by']
class MainPage(webapp.RequestHandler):
def get(self):
self.response.out.write('<html><body>'
'<form method="POST" '
'action="/">'
'<table>')
# This generates our shopping list form and writes it in the response
self.response.out.write(ItemForm())
self.response.out.write('</table>'
'<input type="submit">'
'</form></body></html>')
def post(self):
data = ItemForm(data=self.request.POST)
if data.is_valid():
# Save the data, and redirect to the view page
entity = data.save(commit=False)
entity.added_by = users.get_current_user()
entity.put()
self.redirect('/items.html')
else:
# Reprint the form
self.response.out.write('<html><body>'
'<form method="POST" '
'action="/">'
'<table>')
self.response.out.write(data)
self.response.out.write('</table>'
'<input type="submit">'
'</form></body></html>')
Is any easy way to validate form which contain data from few tables or I have to code it alone?
Looks like you're using webapp; I suggest your look at some other 'light-weight' choices for form validation. Pick one that you like the layout / syntax of. You'll be able to define complex 'nested' relationships if needed.
FormEncode
Formish
Deform
WTForms has a GAE component WTForms
WTForms now includes support for AppEngine fields as well as auto-form generation. The form class can be used as it is or serve as a base for extended form classes, which can then mix non-model related fields, subforms with other model forms, among other possibilities.

Related Links

Is there any way to handle Google Datastore Kind Property names with spaces in Golang?
Google App Engine: Disable favicon.ico
Google Cloud DataStore. How to serve data?
How to access a cloud storage bucket from app engine without getting the 403 FORBIDDEN error?
Google App Engine Custom Domain - Routing in Go
Best approach for caching lists of objects in memcache
com.google.gcloud.datastore vs com.google.appengine.api.datastore
Google App Engine - Issue with creating a bulkloading config
Solr Timeout error even data is instered
Why does BigQuery fail to parse an Avro file that is accepted by avro-tools?
Insufficient Permission with Appengine Flex service account to access Drive folder
Getting Invalid Key message thrown when creating child records
Where do I find the pricing for the different frontend instance types?
Missing index on specific entities in app engine
Get current deployed timestamp in AppEngine/Go
Jersey throwing exception in Google App Engine

Categories

HOME
service-worker
nvd3.js
gpu
phpmyadmin
numbers
composite-primary-key
apiblueprint
entity-framework-core
square
odoo-8
rcloud
p2p
augeas
pega
android-securityexception
jsonpath
php-5.6
google-form
shared-libraries
dynatrace
eip
feathersjs
easyphp
nodemcu
apache2.4
squashfs
imagemap
visual-studio-extensions
epsilon
siri
moses
gpio
licensing
subclass
uitapgesturerecognizer
recurring-events
linkedhashmap
classcastexception
sharding
slacktextviewcontroller
sql-server-ce
ideascript
connection-pool
css-position
demo
attributeerror
install.packages
x++
plan-9
flask-restful
openresty
vugen
bluez
trojan
azure-cli
filehandle
jqchart
boo
monkey
django-1.10
testrail
file-uri
vorpal.js
nss
aurora
wiredep
cgi-bin
snoop
kubuntu
zend-currency
openbabel
procedural-programming
sonarqube-5.0
punycode
linkedin-jsapi
wcm
named-parameters
xml-dsig
http-patch
jammer
mbunit
inappsettingskit
cardreader
curb
jquery-blockui
dajaxice
stress
dataform
resharper-6.0
easyb
zend-rest
zen
request-headers
strtod
wcf-instancing
firefox-3
business-model

Resources

Encrypt Message