mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 05:54:19 +01:00
19 lines
542 B
Python
19 lines
542 B
Python
from CTFd.models import ma, Notifications
|
|
from CTFd.utils import string_types
|
|
|
|
|
|
class NotificationSchema(ma.ModelSchema):
|
|
class Meta:
|
|
model = Notifications
|
|
include_fk = True
|
|
dump_only = ('id', 'date')
|
|
|
|
def __init__(self, view=None, *args, **kwargs):
|
|
if view:
|
|
if isinstance(view, string_types):
|
|
kwargs['only'] = self.views[view]
|
|
elif isinstance(view, list):
|
|
kwargs['only'] = view
|
|
|
|
super(NotificationSchema, self).__init__(*args, **kwargs)
|