Skip to content

Commit

Permalink
Query performance improvements #149
Browse files Browse the repository at this point in the history
  • Loading branch information
dennissiemensma committed Aug 15, 2016
1 parent aa97cb4 commit 35d2df0
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ v1.3.1 - 2016-xx-xx
- CSS large margin-bottom (`#144 <https://github.com/dennissiemensma/dsmr-reader/issues/144>`_).
- Django security releases issued: 1.8.14 (`#147 <https://github.com/dennissiemensma/dsmr-reader/issues/147>`_).
- Requirements update (August 2016) (`#148 <https://github.com/dennissiemensma/dsmr-reader/issues/148>`_).
- Query performance improvements (`#149 <https://github.com/dennissiemensma/dsmr-reader/issues/149>`_).


v1.3.0 - 2016-07-15
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dsmr_consumption', '0002_verbose_text'),
]

operations = [
migrations.AlterField(
model_name='electricityconsumption',
name='currently_delivered',
field=models.DecimalField(decimal_places=3, help_text='Actual electricity power delivered (+P) in 1 Watt resolution', db_index=True, max_digits=9),
),
migrations.AlterField(
model_name='electricityconsumption',
name='currently_returned',
field=models.DecimalField(decimal_places=3, help_text='Actual electricity power received (-P) in 1 Watt resolution', db_index=True, max_digits=9),
),
]
6 changes: 4 additions & 2 deletions dsmr_consumption/models/consumption.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ class ElectricityConsumption(models.Model):
currently_delivered = models.DecimalField(
max_digits=9,
decimal_places=3,
help_text=_("Actual electricity power delivered (+P) in 1 Watt resolution")
help_text=_("Actual electricity power delivered (+P) in 1 Watt resolution"),
db_index=True
)
currently_returned = models.DecimalField(
max_digits=9,
decimal_places=3,
help_text=_("Actual electricity power received (-P) in 1 Watt resolution")
help_text=_("Actual electricity power received (-P) in 1 Watt resolution"),
db_index=True
)

def __str__(self):
Expand Down
2 changes: 1 addition & 1 deletion dsmrreader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
from django.utils.version import get_version


VERSION = (1, 3, 1, 'beta', 3)
VERSION = (1, 3, 1, 'beta', 4)

__version__ = get_version(VERSION)
9 changes: 9 additions & 0 deletions dsmrreader/config/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,12 @@
},
},
}

INSTALLED_APPS = list(INSTALLED_APPS)
INSTALLED_APPS.append('debug_toolbar')

DEBUG_TOOLBAR_PATCH_SETTINGS = False

MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
MIDDLEWARE_CLASSES.insert(0, 'debug_toolbar.middleware.DebugToolbarMiddleware')
INTERNAL_IPS = '127.0.0.1'
7 changes: 7 additions & 0 deletions dsmrreader/config/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
# Only available (and required) for tests, so inject it here.
INSTALLED_APPS = list(INSTALLED_APPS)
INSTALLED_APPS.append('django_nose')
INSTALLED_APPS.remove('debug_toolbar')

# Disable DDT.
MIDDLEWARE_CLASSES = list(MIDDLEWARE_CLASSES)
MIDDLEWARE_CLASSES.remove('debug_toolbar.middleware.DebugToolbarMiddleware')

INTERNAL_IPS = None

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
Expand Down
Binary file modified dsmrreader/locales/nl/LC_MESSAGES/django.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion dsmrreader/locales/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: DSMR Reader\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-15 20:55+0200\n"
"POT-Creation-Date: 2016-08-15 22:55+0200\n"
"PO-Revision-Date: 2016-07-13 22:58+0100\n"
"Last-Translator: Dennis Siemensma <dsmr@dennissiemensma.nl>\n"
"Language-Team: Dennis Siemensma <dsmr@dennissiemensma.nl>\n"
Expand Down
1 change: 1 addition & 0 deletions dsmrreader/provisioning/requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
django-debug-toolbar==1.5
Sphinx==1.4.5
sphinx-autobuild==0.6.0
sphinx-intl==0.9.9
Expand Down
9 changes: 9 additions & 0 deletions dsmrreader/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,18 @@
"""
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings


urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^api/v1/', include('dsmr_api.urls', namespace='api')),
url(r'^', include('dsmr_frontend.urls', namespace='frontend')),
]

if settings.DEBUG:
import debug_toolbar

urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
]

0 comments on commit 35d2df0

Please sign in to comment.