Prevent null in boolean column. fix #1374
This commit is contained in:
1 parent
de36faa0a7
commit
a97570027d
1 file changed
+15
-9
@@ -76,7 +76,7 @@ class LibraryTitle(Entity):
|
|||||||
|
|
||||||
title = Field(Unicode)
|
title = Field(Unicode)
|
||||||
simple_title = Field(Unicode, index = True)
|
simple_title = Field(Unicode, index = True)
|
||||||
default = Field(Boolean, index = True)
|
default = Field(Boolean, default = False, index = True)
|
||||||
|
|
||||||
language = OneToMany('Language')
|
language = OneToMany('Language')
|
||||||
libraries = ManyToOne('Library')
|
libraries = ManyToOne('Library')
|
||||||
@@ -146,7 +146,7 @@ class Quality(Entity):
|
|||||||
|
|
||||||
identifier = Field(String(20), unique = True)
|
identifier = Field(String(20), unique = True)
|
||||||
label = Field(Unicode(20))
|
label = Field(Unicode(20))
|
||||||
order = Field(Integer, index = True)
|
order = Field(Integer, default = 0, index = True)
|
||||||
|
|
||||||
size_min = Field(Integer)
|
size_min = Field(Integer)
|
||||||
size_max = Field(Integer)
|
size_max = Field(Integer)
|
||||||
@@ -160,21 +160,27 @@ class Profile(Entity):
|
|||||||
using_options(order_by = 'order')
|
using_options(order_by = 'order')
|
||||||
|
|
||||||
label = Field(Unicode(50))
|
label = Field(Unicode(50))
|
||||||
order = Field(Integer, index = True)
|
order = Field(Integer, default = 0, index = True)
|
||||||
core = Field(Boolean)
|
core = Field(Boolean, default = False)
|
||||||
hide = Field(Boolean)
|
hide = Field(Boolean, default = False)
|
||||||
|
|
||||||
movie = OneToMany('Movie')
|
movie = OneToMany('Movie')
|
||||||
types = OneToMany('ProfileType', cascade = 'all, delete-orphan')
|
types = OneToMany('ProfileType', cascade = 'all, delete-orphan')
|
||||||
|
|
||||||
|
def to_dict(self, deep = {}, exclude = []):
|
||||||
|
orig_dict = super(Profile, self).to_dict(deep = deep, exclude = exclude)
|
||||||
|
orig_dict['core'] = orig_dict.get('core') or False
|
||||||
|
orig_dict['hide'] = orig_dict.get('hide') or False
|
||||||
|
|
||||||
|
return orig_dict
|
||||||
|
|
||||||
class ProfileType(Entity):
|
class ProfileType(Entity):
|
||||||
""""""
|
""""""
|
||||||
using_options(order_by = 'order')
|
using_options(order_by = 'order')
|
||||||
|
|
||||||
order = Field(Integer, index = True)
|
order = Field(Integer, default = 0, index = True)
|
||||||
finish = Field(Boolean)
|
finish = Field(Boolean, default = True)
|
||||||
wait_for = Field(Integer)
|
wait_for = Field(Integer, default = 0)
|
||||||
|
|
||||||
quality = ManyToOne('Quality')
|
quality = ManyToOne('Quality')
|
||||||
profile = ManyToOne('Profile')
|
profile = ManyToOne('Profile')
|
||||||
@@ -185,7 +191,7 @@ class File(Entity):
|
|||||||
|
|
||||||
path = Field(Unicode(255), nullable = False, unique = True)
|
path = Field(Unicode(255), nullable = False, unique = True)
|
||||||
part = Field(Integer, default = 1)
|
part = Field(Integer, default = 1)
|
||||||
available = Field(Boolean)
|
available = Field(Boolean, default = True)
|
||||||
|
|
||||||
type = ManyToOne('FileType')
|
type = ManyToOne('FileType')
|
||||||
properties = OneToMany('FileProperty')
|
properties = OneToMany('FileProperty')
|
||||||
|
|||||||
Reference in new issue
Block a user