Thanks a lot! It works but I still have a problem. I want to make one query
to get the root directory, all its children and the filenames of Image
objects.
My directory model looks like this:
class Directory(Node):
is_root = db.Column(db.Boolean, default=False)
children =
On 9/16/15 5:28 AM, Jakub Bąk wrote:
Thanks a lot! It works but I still have a problem. I want to make one
query to get the root directory, all its children and the filenames of
Image objects.
My directory model looks like this:
|
classDirectory(Node):
is_root
On 9/15/15 10:09 AM, Jakub Bąk wrote:
I used before_delete and after_commit and it works like a charm.
Thanks again!
I have another problem related to this setup. I have a property
defined on the Image model:
|
@property
deffilename(self):
I used before_delete and after_commit and it works like a charm. Thanks
again!
I have another problem related to this setup. I have a property defined on
the Image model:
@property
def filename(self):
return '{basename}.{extension}'.format(basename=self.basename, extension
=self.extension)
Those are some great ideas. I will try them out. Thanks Michael!
W dniu wtorek, 25 sierpnia 2015 17:16:16 UTC+2 użytkownik Michael Bayer
napisał:
On 8/25/15 10:05 AM, Jakub Bąk wrote:
I just came across a solution to this problem. Adding 'with_polymorphic':
'*' to __mapper_args__ on the
On 8/25/15 10:05 AM, Jakub Bąk wrote:
I just came across a solution to this problem.
Adding 'with_polymorphic': '*' to __mapper_args__ on the Node model
was enough.
|
classNode(db.Model):
id =db.Column(db.Integer,primary_key=True)
type =db.Column(db.String(20))
name
I just came across a solution to this problem. Adding 'with_polymorphic':
'*' to __mapper_args__ on the Node model was enough.
class Node(db.Model):
id = db.Column(db.Integer, primary_key=True)
type = db.Column(db.String(20))
name = db.Column(db.String(30), nullable=False)
date_added