Fixing some database integration errors

This commit is contained in:
charltonaustin 2016-10-10 10:51:30 -04:00
parent 075e87089f
commit 4ae6e6efa9
3 changed files with 9 additions and 5 deletions

View file

@ -774,7 +774,7 @@ class LogEntry(BaseModel):
(('repository', 'datetime', 'kind'), False),
)
class Message(BaseModel):
class Messages(BaseModel):
content = TextField()
class RepositoryActionCount(BaseModel):

View file

@ -1,12 +1,12 @@
from data.database import Message
from data.database import Messages
def get_messages():
messages = []
for message in Message.select():
for message in Messages.select():
messages.append({'id': message.id, 'content': message.content})
return messages
def create(messages):
for message in messages:
Message.create(content=message['content'])
Messages.create(content=message['content'])

View file

@ -11,7 +11,11 @@ angular.module('quay').directive('quayMessageBar', function () {
scope: {},
controller: function ($scope, $element, ApiService) {
$scope.messages = [];
ApiService.getMessages().then(function(data){ $scope.messages = data['messages'] || []; });
try {
ApiService.getMessages().then(function (data) {
$scope.messages = data['messages'] || [];
});
}
}
};
});