def insert_notifications(apps, schema_editor):
import dsmr_frontend.services
Notification = apps.get_model('dsmr_frontend', 'Notification')
# Search for any applied migrations in the past. This should indicate a long(er) living instance of the project.
existing_project = MigrationRecorder.Migration.objects.filter(
applied__lt=timezone.now() - timezone.timedelta(hours=24)
).exists()
if existing_project:
return
Notification.objects.create(
message=dsmr_frontend.services.get_translated_string(
text=_('Welcome to DSMR-reader! Please make sure to check your settings in the Configuration page!')
),
redirect_to='admin:index'
)
Notification.objects.create(
message=dsmr_frontend.services.get_translated_string(
text=_('You may check the status of your readings and data in the Status page.')
),
redirect_to='frontend:status'
)
0006_notifications_initial.py 文件源码
python
阅读 20
收藏 0
点赞 0
评论 0
评论列表
文章目录