colin_dev256 colin_dev256 - 1 year ago 92
AngularJS Question

Python: [object Object] showing up on page field

I am developing an angularjs app on google app engine however I have an issue displaying one of my


This is how the KeyProperty field is displaying (The other non KeyProperty elements are showing up fine);

NB: Post is 200 OK

enter image description here

class Project(ndb.Model):
projectID = ndb.IntegerProperty(required=True)
title = ndb.StringProperty(required=True)
description = ndb.StringProperty(required=True)
startAt = ndb.DateTimeProperty(indexed=True)
endAt = ndb.DateTimeProperty()
client = ndb.KeyProperty(kind='Client')

class Client(ndb.Model):
name = ndb.StringProperty()

home.html element

<div class="form-group">
<label>Client : </label>
<input type="text" ng-model="Project.Client" class="form-control"/>


def post(self):
r = json.loads(self.request.body)
print str(r)

cl = Client(name=r['Client']).put()
client_key = cl

g = Project(projectID=int(r['ProjectID']),
startAt=datetime.strptime(r['StartAt'], '%Y-%m-%dT%H:%M:%S.%fZ'),
endAt=datetime.strptime(r['EndAt'], '%Y-%m-%dT%H:%M:%S.%fZ'))

project_key = g.put()


eventClick: function (project) {
$scope.showSelected = true;

var fromDate = moment(project.start).format('DD/MM/YYYY LT');
var endDate = moment(project.end).format('DD/MM/YYYY LT');

$scope.Project = {
ProjectID : project.projectID,
Client : project.client,
Title : project.title,
Description: project.description,
Employees: project.employees,
StartAt : fromDate,
EndAt : endDate,
IsFullDay : false

I am still learning my way to handling KeyProperties. Thanks for the help


This is the error I am getting when I type 'qwert' in the Client field;

enter image description here

Answer Source

I am talking about in your Python code. The error log should tell you what line of your code was expecting a string. That is where you need the .name

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download