Add recipient notification detail and filtering, a queued admin composer, and contextual automatic titles. Retire email delivery, obsolete auth routes, newsletter data, and related templates and settings.
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
from django.contrib.auth import get_user_model
|
|
|
|
from import_export import resources, fields
|
|
from import_export.widgets import ForeignKeyWidget
|
|
|
|
from apps.communications.models import Announcement, PushNotificationDevice
|
|
|
|
User = get_user_model()
|
|
|
|
|
|
class AnnouncementResource(resources.ModelResource):
|
|
author = fields.Field(
|
|
column_name='author',
|
|
attribute='author',
|
|
widget=ForeignKeyWidget(User, 'username')
|
|
)
|
|
|
|
class Meta:
|
|
model = Announcement
|
|
fields = (
|
|
'id', 'title', 'content', 'announcement_type', 'priority',
|
|
'author', 'is_published', 'publish_date', 'created_at', 'updated_at'
|
|
)
|
|
export_order = fields
|
|
|
|
|
|
class PushNotificationDeviceResource(resources.ModelResource):
|
|
user = fields.Field(
|
|
column_name='user',
|
|
attribute='user',
|
|
widget=ForeignKeyWidget(User, 'username')
|
|
)
|
|
|
|
class Meta:
|
|
model = PushNotificationDevice
|
|
fields = (
|
|
'id', 'user', 'device_type', 'is_active', 'created_at', 'updated_at'
|
|
)
|
|
export_order = fields
|