Commit 905e75d4 authored by Zach Perkins's avatar Zach Perkins
Browse files

Got rid of as_json methods

parent df973667
...@@ -34,6 +34,7 @@ class Point(Base): ...@@ -34,6 +34,7 @@ class Point(Base):
super(Point, self).__init__(**kwargs) super(Point, self).__init__(**kwargs)
@validates('attributes') @validates('attributes')
def validate_data(self, _, data): def validate_data(self, _, data):
if data is None: if data is None:
...@@ -51,18 +52,6 @@ class Point(Base): ...@@ -51,18 +52,6 @@ class Point(Base):
field.validate_data(data[key]) field.validate_data(data[key])
return data return data
def as_json(self, children=True):
if children:
children = [child.as_json(children=False) for child in self.children]
return {
"name": self.name,
"lat": self.lat,
"lon": self.lon,
"category": self.category.id,
"attributes": self.attributes,
"children": children
}
class Category(Base): class Category(Base):
""" """
...@@ -76,14 +65,6 @@ class Category(Base): ...@@ -76,14 +65,6 @@ class Category(Base):
fields = relationship("Field") fields = relationship("Field")
def as_json(self):
return {
"id": self.id,
"name": self.name,
"icon": self.icon,
"attributes": {attr.slug: attr.as_json() for attr in self.fields}
}
class Field(Base): class Field(Base):
""" """
...@@ -104,10 +85,3 @@ class Field(Base): ...@@ -104,10 +85,3 @@ class Field(Base):
Verify that data is the correct type for this Field. Verify that data is the correct type for this Field.
""" """
self.type.validate(data) self.type.validate(data)
def as_json(self):
return {
"slug": self.slug,
"name": self.name,
"type": self.type.name
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment