|
@@ 361-401 (lines=41) @@
|
| 358 |
|
|
| 359 |
|
|
| 360 |
|
class AdminModerationController(AdminController): |
| 361 |
|
""" |
| 362 |
|
PyJobs' admin sub-controller in charge of managing moderation related |
| 363 |
|
routing in the admin. Every table in the model that requires moderation |
| 364 |
|
should be added to the 'to_moderate' list. |
| 365 |
|
""" |
| 366 |
|
|
| 367 |
|
""" |
| 368 |
|
A list containing every tables in the Postgresql database that should be |
| 369 |
|
handled by this controller. |
| 370 |
|
""" |
| 371 |
|
to_moderate = [model.CompanyAlchemy] |
| 372 |
|
|
| 373 |
|
def __init__(self): |
| 374 |
|
super(AdminModerationController, self).__init__( |
| 375 |
|
self.to_moderate, DBSession, config_type=ModerationAdminConfig) |
| 376 |
|
|
| 377 |
|
@property |
| 378 |
|
def moderation_list(self): |
| 379 |
|
models = [table.__name__ for table in self.config.models.values()] |
| 380 |
|
models.sort() |
| 381 |
|
|
| 382 |
|
moderation_list = list() |
| 383 |
|
for m in models: |
| 384 |
|
moderation_list.append(dict(link='%ss' % m.lower(), display=m)) |
| 385 |
|
|
| 386 |
|
return moderation_list |
| 387 |
|
|
| 388 |
|
@with_trailing_slash |
| 389 |
|
@expose() |
| 390 |
|
def index(self): |
| 391 |
|
# We use a custom index template, therefore, we have to change the dict |
| 392 |
|
# that's returned by the super.index() method, so that our template gets |
| 393 |
|
# the values it needs to operate correctly. |
| 394 |
|
super_res = super(AdminModerationController, self).index() |
| 395 |
|
|
| 396 |
|
res = dict(config=super_res['config'], |
| 397 |
|
model_config=super_res['model_config'], |
| 398 |
|
moderation_list=self.moderation_list) |
| 399 |
|
|
| 400 |
|
return res |
| 401 |
|
|
| 402 |
|
|
| 403 |
|
class PyJobsAdminLayout(BootstrapAdminLayout): |
| 404 |
|
""" |
|
@@ 318-358 (lines=41) @@
|
| 315 |
|
|
| 316 |
|
|
| 317 |
|
class AdminGeocodingController(AdminController): |
| 318 |
|
""" |
| 319 |
|
PyJobs' admin sub-controller in charge of managing geolocation issues |
| 320 |
|
related routing in the admin. Every table in the model that might have |
| 321 |
|
geocoding issues should be added to the 'to_fix' list. |
| 322 |
|
""" |
| 323 |
|
|
| 324 |
|
""" |
| 325 |
|
A list containing every tables in the Postgresql database that might have |
| 326 |
|
geocoding issues that should be handled by this controller. |
| 327 |
|
""" |
| 328 |
|
to_fix = [model.JobAlchemy, model.CompanyAlchemy] |
| 329 |
|
|
| 330 |
|
def __init__(self): |
| 331 |
|
super(AdminGeocodingController, self).__init__( |
| 332 |
|
self.to_fix, DBSession, config_type=GeocodingAdminConfig) |
| 333 |
|
|
| 334 |
|
@property |
| 335 |
|
def geocoding_list(self): |
| 336 |
|
models = [table.__name__ for table in self.config.models.values()] |
| 337 |
|
models.sort() |
| 338 |
|
|
| 339 |
|
geocoding_list = list() |
| 340 |
|
for m in models: |
| 341 |
|
geocoding_list.append(dict(link='%ss' % m.lower(), display=m)) |
| 342 |
|
|
| 343 |
|
return geocoding_list |
| 344 |
|
|
| 345 |
|
@with_trailing_slash |
| 346 |
|
@expose() |
| 347 |
|
def index(self): |
| 348 |
|
# We use a custom index template, therefore, we have to change the dict |
| 349 |
|
# that's returned by the super.index() method, so that our template gets |
| 350 |
|
# the values it needs to operate correctly. |
| 351 |
|
super_res = super(AdminGeocodingController, self).index() |
| 352 |
|
|
| 353 |
|
res = dict(config=super_res['config'], |
| 354 |
|
model_config=super_res['model_config'], |
| 355 |
|
geocoding_list=self.geocoding_list) |
| 356 |
|
|
| 357 |
|
return res |
| 358 |
|
|
| 359 |
|
|
| 360 |
|
class AdminModerationController(AdminController): |
| 361 |
|
""" |