Skip to content

Commit

Permalink
add creation date in order
Browse files Browse the repository at this point in the history
  • Loading branch information
william57m committed Nov 6, 2014
1 parent 9d5dfa6 commit 55311c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion webserver/controllers/orders.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def list():
Method: *GET*
URI: */orders*
Parameters: state=?
Parameters: ?state=id
?client_id=id
0: En attente
1: En préparation
2: Prête
Expand Down
3 changes: 3 additions & 0 deletions webserver/models/order.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from webserver.models import Base
from sqlalchemy import Column, Integer, DateTime, ForeignKey, String
from sqlalchemy.orm import relationship
from datetime import datetime

class Order(Base):
__tablename__ = 'order'
Expand All @@ -9,6 +10,7 @@ class Order(Base):

number = Column(Integer, nullable=False)
date = Column(DateTime, nullable=False)
created = Column(DateTime, default=datetime.now)

client_id = Column(Integer, ForeignKey('client.id'))
client = relationship("Client")
Expand All @@ -24,6 +26,7 @@ def to_dict(self, lines_order=True):
my_dict['id'] = self.id
my_dict['number'] = self.number
my_dict['date'] = unicode(self.date)
my_dict['created'] = unicode(self.created)
my_dict['client'] = self.client.to_dict() if self.client else None

if lines_order:
Expand Down

0 comments on commit 55311c0

Please sign in to comment.