Skip to content

Instantly share code, notes, and snippets.

View britalmeida's full-sized avatar

Inês Almeida britalmeida

View GitHub Profile
@britalmeida
britalmeida / model.py
Last active November 26, 2015 00:05
flask-sqlalchemy: polymorphic and python mixin
class Asset(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(120), nullable=False)
asset_type_id = db.Column(db.Integer(), db.ForeignKey('asset_type.id'), nullable=False)
asset_type = db.relationship('AssetType', backref='assets')
# I would like a nicer way to do this
@property
def versions(self):
@britalmeida
britalmeida / manage.py
Last active August 29, 2015 14:00
Scripts for operations on the blender-cloud database
from __future__ import division
from flask.ext.script import Manager
from sqlalchemy import update
import os
import subprocess
import json
from server import app
from server import db