Noah Clark Noah Clark - 1 year ago 78
Python Question

I have Data Models...Now What in Google App Engine With Python

I have what I think I need for models in google app engine. I'm building basically a classifieds ad system.

Here's what I have so far:

class Cities(db.Model):
name = db.StringProperty()
connectors = db.ListProperty()
catList = db.ListProperty()

class Listings(db.model):
title = db.StringProperty()
category = db.CategoryProperty()
city = db.StringProperty()
editURL = db.LinkProperty()
email = db.EmailProperty()
phone = db.PhoneNumber()
user = db.UserProperty()
date = db.DateTimeProperty(auto_now_add=True)
content = db.TextProperty()
picture = db.BlobProperty()
location = db.StringProperty()

Is there anything obviously wrong with those? Also, I have these in a file called in the same directory as all my other files for Google App engine. Is there a way I can import these into the particular files where they'll need to be used?

Lastly, I have a list of cities I want to be represented. How do I get that into google app engine? Is the right thing to do is build a dashboard in which I can create my own cities?

Thank you all in advance!

Answer Source
  1. There is nothing obviously wrong with them
  2. In something like have from dbmodels import Cities, Listings (assuming they are in the same folder), and use Cities and Listings
  3. It is the right way, but make sure only administrators can edit that. (Or, better, read Thomas K's comment below)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download