i am currently facing problem on opening html page using django although i have tried to figure out on the url.py, view.py, and the html page. My code is stated below:
batterycurrent.py under views folder
from __future__ import absolute_import
from __future__ import unicode_literals
from django.core.files.storage import default_storage
from django.core.urlresolvers import reverse_lazy
from django.http import HttpResponseRedirect
from django.utils import timezone
from django.views.generic import FormView, TemplateView
from sendfile import sendfile
import os.path
from .mixin import AjaxTemplateMixin, PermissionRequiredMixin, PageTitleMixin
from ..forms import DiagnosticsForm
from ..tasks import dump_diagnostics
from django.shortcuts import render
class DiagnosticMixin(PageTitleMixin, PermissionRequiredMixin):
permission_required = ['system.view_log_files']
page_title = 'Diagnostics'
form_class = DiagnosticsForm
class BatteryCurrentView(DiagnosticMixin,FormView):
template_name = 'system/batterycurrent.html'
def batterycurrent(request):
return render(request, 'system/batterycurrent.html')
url.py
from __future__ import absolute_import
from __future__ import unicode_literals
from collections import OrderedDict
from django.conf.urls import url
from django.core.urlresolvers import reverse_lazy
from .views import BatteryCurrentView
sub_urlpatterns['diagnostic'] = [
url(r'^diagnostics$', DiagnosticView.as_view(), name='diagnostic'),
url(r'^diagnostics/download', DiagnosticDownloadView.as_view(), name='diagnostic-download'),
url(r'^diagnostics/batterycurrent', BatteryCurrentView.as_view(), name='batterycurrent'),
]
**the batterycurrent.html is within diagnostic.html.
batterycurrent.html(Template (the html is in the system folder)
<li><a href="{% url 'system:batterycurrent' %}">Battery Current Vs Timestamp</a></li>
when i started to execute the code, the errors appeared
i) importError batterycurrentView couldn't be imported
ii)Reverse for 'batterycurrent' with arguments '()' and keyword arguments '{}'
not found. 0 pattern(s) tried: []
Please guide me on this