Skip to content

Commit

Permalink
MySQL: Staat stil op: "Stats: Missing consumption data for: ..." #909
Browse files Browse the repository at this point in the history
  • Loading branch information
dennissiemensma committed Mar 3, 2020
1 parent d6900a6 commit fb62707
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
40 changes: 40 additions & 0 deletions dsmr_frontend/migrations/0034_mysql_timezone_support.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Generated by Django 3.0.3 on 2020-03-03 18:24

from django.db import migrations, connection
from django.utils.translation import ugettext_lazy


def migrate_forward(apps, schema_editor):
import dsmr_frontend.services

if connection.vendor != 'mysql':
return

with connection.cursor() as cursor:
cursor.execute("SELECT 1 FROM mysql.time_zone_name LIMIT 1")

if cursor.rowcount > 0:
return

Notification = apps.get_model('dsmr_frontend', 'Notification')
Notification.objects.create(
message=dsmr_frontend.services.get_translated_string(text=ugettext_lazy(
'You are using a MySQL database without timezone support. This may cause bugs. Please enable timezone '
'support in your database, see: https://dev.mysql.com/doc/refman/en/mysql-tzinfo-to-sql.html'
))
)


def migrate_backward(apps, schema_editor):
pass


class Migration(migrations.Migration):

operations = [
migrations.RunPython(migrate_forward, migrate_backward),
]

dependencies = [
('dsmr_frontend', '0033_django_colorfield_update'),
]
Binary file modified dsmrreader/locales/nl/LC_MESSAGES/django.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions dsmrreader/locales/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,9 @@ msgstr "DSMR-reader v3.4.0 (2/3): Vanaf deze release kun je zelf de naamgeving v
msgid "DSMR-reader v3.4.0 (3/3): Graphs formerly displayed on the Dashboard are now available in \"Live graphs\"."
msgstr "DSMR-reader v3.4.0 (3/3): Grafieken die voorheen op het Dashboard stonden, zijn nu beschikbaar onder \"Live grafieken\"."

msgid "You are using a MySQL database without timezone support. This may cause bugs. Please enable timezone support in your database, see: https://dev.mysql.com/doc/refman/en/mysql-tzinfo-to-sql.html"
msgstr "Je gebruikt een MySQL-database zonder ondersteuning voor tijdzones. Dit kan fouten veroorzaken. Zet ondersteuning voor tijdzones aan in je database, zie: https://dev.mysql.com/doc/refman/en/mysql-tzinfo-to-sql.html"

msgid "Application notification"
msgstr "Applicatienotificatie"

Expand Down

0 comments on commit fb62707

Please sign in to comment.