|
Android example source code file (dashboard.py)
This example Android source code file (dashboard.py) is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn
Android by Example" TM.
The dashboard.py Android example source code
#!/usr/bin/python2.5
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
"""Defines Django forms for inserting/updating/viewing data
to/from SampleSyncAdapter datastore."""
import cgi
import datetime
import os
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.db import djangoforms
from model import datastore
import wsgiref.handlers
class UserForm(djangoforms.ModelForm):
"""Represents django form for entering user info."""
class Meta:
model = datastore.User
class UserInsertPage(webapp.RequestHandler):
"""Inserts new users. GET presents a blank form. POST processes it."""
def get(self):
self.response.out.write('<html>'
'<form method="POST" '
'action="/add_user">'
'<table>')
# This generates our shopping list form and writes it in the response
self.response.out.write(UserForm())
self.response.out.write('</table>'
'<input type="submit">'
'</form> |