-
Notifications
You must be signed in to change notification settings - Fork 16
/
models.py
executable file
·366 lines (306 loc) · 13.3 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
from database import Base
from flask_security import UserMixin, RoleMixin
from sqlalchemy.orm import relationship, backref
from sqlalchemy import Boolean, DateTime, Column, Integer, String, ForeignKey, Text
import datetime
class Setup(Base):
__tablename__ = 'setup'
id = Column(Integer(), primary_key=True, autoincrement=True)
appname = Column(String(50), unique=True, nullable=False)
settted = Column(Boolean(), default=False)
def __init__(self, appname=None, setted=None):
self.appname = appname
self.settted = setted
class RolesUsers(Base):
__tablename__ = 'roles_users'
id = Column(Integer(), primary_key=True, autoincrement=True)
user_id = Column('user_id', Integer(), ForeignKey('user.id'))
role_id = Column('role_id', Integer(), ForeignKey('role.id'))
def __init__(self, user_id, role_id):
self.user_id = user_id
self.role_id = role_id
class Role(Base, RoleMixin):
__tablename__ = 'role'
id = Column(Integer(), primary_key=True)
name = Column(String(80), unique=True)
description = Column(String(255))
def __init__(self, name=None, description=None):
self.name = name
self.description = description
def __repr__(self):
return self.name
class User(Base, UserMixin):
__tablename__ = 'user'
id = Column(Integer, primary_key=True, autoincrement=True)
email = Column(String(255), unique=True)
username = Column(String(255))
password = Column(String(255))
active = Column(Boolean())
last_time = Column(DateTime())
roles = relationship('Role', secondary='roles_users', backref=backref('users', lazy='dynamic'))
def __init__(self, email=None, username=None, password=None, active=None, last_time=None):
self.email = email
self.username = username
self.password = password
self.active = active
self.last_time = last_time
class Agency(Base):
__tablename__ = 'agency'
id = Column(Integer, primary_key=True, autoincrement=True)
company = Column(String(80), nullable=True)
phone = Column(Integer(), nullable=True)
director = Column(String(80), nullable=True)
photo = Column(Text, nullable=True)
description = Column(Text, nullable=True)
instagram = Column(Text, nullable=True)
facebook = Column(Text, nullable=True)
twitter = Column(Text, nullable=True)
def __init__(self, company=None, phone=None, director=None, photo=None, description=None, instagram=None,
facebook=None, twitter=None):
self.company = company
self.phone = phone
self.director = director
self.photo = photo
self.description = description
self.instagram = instagram
self.facebook = facebook
self.twitter = twitter
class StaticNav(Base):
__tablename__ = 'staticnav'
id = Column(Integer, primary_key=True, autoincrement=True)
header = Column(String(80), nullable=True)
link = Column(Text, nullable=True)
activated = Column(Boolean(), default=False)
def __init__(self, header=None, link=None, activated=None):
self.header = header
self.link = link
self.activated = activated
class NormalContact(Base):
__tablename__ = 'normalcontact'
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(80), nullable=True)
email = Column(Text, nullable=False)
subject = Column(String(80), nullable=True)
message = Column(Text, nullable=True)
document = Column(Text, nullable=True)
time = Column(DateTime())
def __init__(self, name=None, email=None, subject=None, message=None, document=None, time=datetime.datetime.now()):
self.name = name
self.email = email
self.subject = subject
self.message = message
self.document = document
self.time = time
class Actors(Base):
__tablename__ = 'actors'
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(80), nullable=False)
surname = Column(String(80), nullable=False)
email = Column(Text, nullable=False, unique=True)
activated = Column(Boolean(), default=False)
gender = Column(String(50), nullable=False)
age = Column(Integer(), nullable=False)
phone = Column(Integer(), nullable=False)
category = relationship('Categories', secondary='actormodel', backref=backref('actors'))
def __init__(self, name=None, surname=None, email=None, activated=None, gender=None, age=None, phone=None):
self.name = name
self.surname = surname
self.email = email
self.activated = activated
self.gender = gender
self.age = age
self.phone = phone
def __repr__(self):
return self.email
class Categories(Base):
__tablename__ = 'categories'
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(80), nullable=False)
description = Column(Text)
def __init__(self, name=None, description=None):
self.name = name
self.description = description
def __repr__(self):
return self.name
class Photos(Base):
__tablename__ = 'photos'
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column('user_id', Integer(), ForeignKey('actors.id'))
photo1 = Column(Text, default="no-data")
photo2 = Column(Text, default="no-data")
photo3 = Column(Text, default="no-data")
photo4 = Column(Text, default="no-data")
photo5 = Column(Text, default="no-data")
photo6 = Column(Text, default="no-data")
photo7 = Column(Text, default="no-data")
photo8 = Column(Text, default="no-data")
photo9 = Column(Text, default="no-data")
photo10 = Column(Text, default="no-data")
actor = relationship('Actors', backref=backref('photo'))
def __init__(self, user_id=None, photo1=None, photo2=None, photo3=None, photo4=None, photo5=None, photo6=None,
photo7=None, photo8=None, photo9=None, photo10=None):
self.user_id = user_id
self.photo1 = photo1
self.photo2 = photo2
self.photo3 = photo3
self.photo4 = photo4
self.photo5 = photo5
self.photo6 = photo6
self.photo7 = photo7
self.photo8 = photo8
self.photo9 = photo9
self.photo10 = photo10
class ActorBody(Base):
__tablename__ = 'actorbody'
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column('user_id', Integer(), ForeignKey('actors.id'))
height = Column(String(20), nullable=True)
weight = Column(String(20), nullable=True)
bodycolor = Column(String(50), nullable=True)
haircolor = Column(String(50), nullable=True)
hairtype = Column(String(50), nullable=True)
eyecolor = Column(String(50), nullable=True)
top = Column(Integer(), nullable=True)
middle = Column(Integer(), nullable=True)
bottom = Column(Integer(), nullable=True)
foot = Column(Integer(), nullable=True)
actor = relationship('Actors', backref=backref('body'))
def __init__(self, user_id=None, height=None, weight=None, bodycolor=None, haircolor=None, hairtype=None,
eyecolor=None, top=None, middle=None, bottom=None, foot=None):
self.user_id = user_id
self.height = height
self.weight = weight
self.bodycolor = bodycolor
self.haircolor = haircolor
self.hairtype = hairtype
self.eyecolor = eyecolor
self.top = top
self.middle = middle
self.bottom = bottom
self.foot = foot
class ActorSoul(Base):
__tablename__ = 'actorsoul'
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column('user_id', Integer(), ForeignKey('actors.id'))
facebook = Column(Text, nullable=True)
twitter = Column(Text, nullable=True)
instagram = Column(Text, nullable=True)
description = Column(Text, nullable=True)
actor = relationship('Actors', backref=backref('soul'))
def __init__(self, user_id=None, facebook=None, twitter=None, instagram=None, description=None):
self.user_id = user_id
self.facebook = facebook
self.twitter = twitter
self.instagram = instagram
self.description = description
class ActorModel(Base):
__tablename__ = 'actormodel'
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column('user_id', Integer(), ForeignKey('actors.id'))
category_id = Column('category_id', Integer(), ForeignKey('categories.id'))
def __init__(self, user_id=None, category_id=None):
self.user_id = user_id
self.category_id = category_id
class TempActors(Base):
__tablename__ = 'Tempactors'
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(80), nullable=False)
surname = Column(String(80), nullable=False)
email = Column(Text, nullable=False, unique=True)
activated = Column(Boolean(), default=False)
gender = Column(String(50), nullable=False)
age = Column(Integer(), nullable=False)
phone = Column(Integer(), nullable=False)
category = relationship('Categories', secondary='Tempactormodel', backref=backref('tempactors'))
def __init__(self, name=None, surname=None, email=None, activated=None, gender=None, age=None, phone=None):
self.name = name
self.surname = surname
self.email = email
self.activated = activated
self.gender = gender
self.age = age
self.phone = phone
class TempPhotos(Base):
__tablename__ = 'Tempphotos'
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column('user_id', Integer(), ForeignKey('Tempactors.id'))
photo1 = Column(Text, default="no-data")
photo2 = Column(Text, default="no-data")
photo3 = Column(Text, default="no-data")
photo4 = Column(Text, default="no-data")
photo5 = Column(Text, default="no-data")
photo6 = Column(Text, default="no-data")
photo7 = Column(Text, default="no-data")
photo8 = Column(Text, default="no-data")
photo9 = Column(Text, default="no-data")
photo10 = Column(Text, default="no-data")
def __init__(self, user_id=None, photo1=None, photo2=None, photo3=None, photo4=None, photo5=None, photo6=None,
photo7=None, photo8=None, photo9=None, photo10=None):
self.user_id = user_id
self.photo1 = photo1
self.photo2 = photo2
self.photo3 = photo3
self.photo4 = photo4
self.photo5 = photo5
self.photo6 = photo6
self.photo7 = photo7
self.photo8 = photo8
self.photo9 = photo9
self.photo10 = photo10
class TempActorBody(Base):
__tablename__ = 'Tempactorbody'
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column('user_id', Integer(), ForeignKey('Tempactors.id'))
height = Column(String(20), nullable=True)
weight = Column(String(20), nullable=True)
bodycolor = Column(String(50), nullable=True)
haircolor = Column(String(50), nullable=True)
hairtype = Column(String(50), nullable=True)
eyecolor = Column(String(50), nullable=True)
top = Column(Integer(), nullable=True)
middle = Column(Integer(), nullable=True)
bottom = Column(Integer(), nullable=True)
foot = Column(Integer(), nullable=True)
def __init__(self, user_id=None, height=None, weight=None, bodycolor=None, haircolor=None, hairtype=None,
eyecolor=None, top=None, middle=None, bottom=None, foot=None):
self.user_id = user_id
self.height = height
self.weight = weight
self.bodycolor = bodycolor
self.haircolor = haircolor
self.hairtype = hairtype
self.eyecolor = eyecolor
self.top = top
self.middle = middle
self.bottom = bottom
self.foot = foot
class TempActorSoul(Base):
__tablename__ = 'Tempactorsoul'
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column('user_id', Integer(), ForeignKey('Tempactors.id'))
facebook = Column(Text, nullable=True)
twitter = Column(Text, nullable=True)
instagram = Column(Text, nullable=True)
description = Column(Text, nullable=True)
def __init__(self, user_id=None, facebook=None, twitter=None, instagram=None, description=None):
self.user_id = user_id
self.facebook = facebook
self.twitter = twitter
self.instagram = instagram
self.description = description
class TempActorModel(Base):
__tablename__ = 'Tempactormodel'
id = Column(Integer, primary_key=True, autoincrement=True)
user_id = Column('user_id', Integer(), ForeignKey('Tempactors.id'))
category_id = Column('category_id', Integer(), ForeignKey('categories.id'))
def __init__(self, user_id=None, category_id=None):
self.user_id = user_id
self.category_id = category_id
class Logs(Base):
__tablename__ = 'logs'
id = Column(Integer, primary_key=True, autoincrement=True)
ip = Column(Integer())
describe = Column(Text)
def __init__(self, ip, describe):
self.ip = ip
self.describe = describe