Re: Caught ViewDoesNotExist while rendering: Could not import smsnotifications.views. Error was: No module named forms
Environment: Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.3 pre-alpha Python Version: 2.6.5 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.gis', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.markup', 'domain', 'testcal', 'buildmanager', 'httptester', 'locations', 'django_tables', 'wqm', 'django_extensions', 'graphing', 'calender', 'backups', 'gdata', 'backends', 'logtracker', 'samples', 'gencal', 'logger', 'user_registration', 'docs', 'hq', 'smsnotifications', 'ajax', 'django_granular_permissions', 'reporters', 'webapp', 'aquaReports', 'requestlogger', 'admin', 'djangogcal', 'aquatest', 'reports', 'standards', 'patterns', 'xformmanager', 'receiver', 'messaging'] Installed Middleware: ['django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.csrf.CsrfMiddleware', 'hq.middleware.hq.HqMiddleware', 'domain.middleware.DomainMiddleware'] Template error: In template /media/Otoro/Development/python/commcare-hq/apps/hq/templates/hq/partials/header.html, error at line 10 Caught ViewDoesNotExist while rendering: Could not import smsnotifications.views. Error was: No module named forms 1 : {% load i18n %} 2 : 3 : {% if user.is_authenticated %} 4 : Logged in as {{user}}{% if user.selected_domain %} in domain {{ user.selected_domain}}{% endif %} | 5 : {% ifnotequal user.active_domains|length 1 %} 6 : Change Domain | 7 : {% endifnotequal %} 8 : 9 : {% if user.is_selected_dom_admin %} 10 : Domain Settings | 11 : {% endif %} 12 : Account Settings | 13 : Admin | 14 : Help | 15 : {% trans "Log out" %} 16 : 17 : {%else%} 18 : {% trans "Log in" %} 19 : {%endif%} 20 : Traceback: File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response 100. response = callback(request, *callback_args, **callback_kwargs) File "apps/domain/decorators.py" in _inner 85. return view_func(request, *args, **kwargs) File "apps/hq/views.py" in dashboard 57. return render_to_response(request, template_name, context) File "rapidsms/lib/rapidsms/webui/utils.py" in render_to_response 121. return django_r_to_r(template_name, rs_dict, **kwargs) File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/__init__.py" in render_to_response 20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs) File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py" in render_to_string 186. return t.render(context_instance) File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py" in render 173. return self._render(context) File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py" in _render 167. return self.nodelist.render(context) File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py" in render 796. bits.append(self.render_node(node, context)) File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py" in render_node 72. result = node.render(context) File "/usr/local/lib/python2.6/dist-packages/django/template/loader_tags.py" in render 125. return compiled_parent._render(context) File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py" in _render 167. return self.nodelist.render(context) File "/usr/local/lib/python2.6/dist-packages/django/template/__init__.py" in render 796. bits.append(self.render_node(node, context)) File "/usr/local/lib/python2.6/dist-packages/django/template/debug.py" in render_node 72. result = node.render(context) File "/usr/local/lib/python2.6/dist-packages/django/template/loader_tags.py" in render 125. return compiled_parent._render(context) File "/usr/local/lib/python
Re: Caught ViewDoesNotExist while rendering: Could not import smsnotifications.views. Error was: No module named forms
Sorry on that.. No i have not imported smsnotification.forms in the smsnotification model. i have from smsnotifications.forms import SmsNotificationForm in the views I further tried to import the smsnotifications.forms import SmsNotificationForm in the django shell it worked okey. but importing views " from smsnotifications import views" i get Traceback (most recent call last): File "", line 1, in File "apps/smsnotifications/views.py", line 51, in from smsnotifications.forms import SmsNotificationForm ImportError: No module named forms but commenting the import of SmsNotificationForm and coding the form directly to the views works okey.. I further try to removed all other imports..except for from smsnotifications.forms import SmsNotificationForm and reduce all the veiw function to pass ie def index(request): pass just to see if the import will work and i still get the error.. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Caught ViewDoesNotExist while rendering: Could not import smsnotifications.views. Error was: No module named forms
On Jun 27, 1:26 pm, Allen Machary wrote: > Hi All, > i have a problem in import problem. in importing forms.py in views.py > here are my files both located in smsnotifications app > -- smsnotifications/forms.py > from django.forms import ModelForm > from smsnotifications.models import SmsNotification > class SmsNotificationForm(ModelForm): > class Meta: > model = SmsNotification > exclude = ('modified','created',) Not sure why you needed to post 200 lines of commented-out code, but never mind. The thing you didn't post, which would have been useful, is the actual traceback. My only guess is that there is a circular dependency somewhere - are you importing smsnotifcations.forms inside smsnotifcations.models, by any chance? -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Caught ViewDoesNotExist while rendering: Could not import smsnotifications.views. Error was: No module named forms
anyone with any idea on this..? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Caught ViewDoesNotExist while rendering: Could not import smsnotifications.views. Error was: No module named forms
Hi All, i have a problem in import problem. in importing forms.py in views.py here are my files both located in smsnotifications app -- smsnotifications/forms.py from django.forms import ModelForm from smsnotifications.models import SmsNotification class SmsNotificationForm(ModelForm): class Meta: model = SmsNotification exclude = ('modified','created',) -- smsnotifications/views.py import logging import hashlib import settings import traceback import sys import os import uuid import string from datetime import timedelta from graphing import dbhelper from django.http import HttpResponse from django.http import HttpResponseRedirect, Http404 from django.template import RequestContext from django.core.exceptions import * from django.views.decorators.http import require_http_methods from django.shortcuts import get_object_or_404 from django.utils.translation import ugettext_lazy as _ from django.db import transaction from django.db.models.query_utils import Q from django.contrib.auth.decorators import login_required from django.contrib.auth.views import redirect_to_login from django.contrib.auth.forms import AdminPasswordChangeForm from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType #from django import forms from rapidsms.webui.utils import render_to_response, paginated #from rapidsms.reporters.models import * #from xformmanager.models import * #from hq.models import * #from graphing.models import * #from receiver.models import * import hq.utils as utils import hq.reporter as reporter import hq.reporter.custom as custom import hq.reporter.metastats as metastats import hq.reporter.inspector as repinspector import hq.reporter.metadata as metadata from domain.decorators import login_and_domain_required from reporters.utils import * from reporters.views import message, check_reporter_form, update_reporter from reporters.models import Reporter, PersistantBackend, PersistantConnection from locations.models import Location, LocationType from wqm.models import WqmAuthority, SamplingPoint from smsnotifications.models import SmsNotification, NotificationChoice from smsnotifications.forms import SmsNotificationForm logger_set = False @login_and_domain_required def index(request): template_name = 'sindex.html' notifications = SmsNotification.objects.all() points = SamplingPoint.objects.all().order_by("name") districts = WqmAuthority.objects.all() return render_to_response(request, template_name, { "notifications": paginated(request, notifications, prefix="smsnotice"), "points" : points, "districts":districts, }) #...@require_http_methods(["GET", "POST"]) #...@login_and_domain_required #def add_notifications(req): # #def get(req): #template_name = "sms-notifications.html" #notifications = SmsNotification.objects.all() #districts = WqmAuthority.objects.all() #points = SamplingPoint.objects.all() #testers = get_tester(req.user) #return render_to_response(req, #template_name, { #"notifications": paginated(req, notifications, prefix="smsnotice"), #"points" : points, #"districts" : districts, #"testers" : testers, #"notification_types_choices" : NotificationChoice.objects.all(), #}) # #@transaction.commit_manually #def post(req): ## check the form for errors #notice_errors = check_notice_form(req) # ## if any fields were missing, abort. #missing = notice_errors["missing"] #exists = notice_errors["exists"] # #if missing: #transaction.rollback() #return message(req, #"Missing Field(s): %s" % comma(missing), #link="/smsnotification/add") ## if authorised tester with same notification and point exists, abort. #if exists: #transaction.rollback() #return message(req, #"%s already exist" % comma(exists), #link="/smsnotification/add") # #try: ## create the notification object from the form #notification = SmsNotification() # #rep = Reporter.objects.get(pk = req.POST.get("authorised_sampler","")) #notification.authorised_sampler = rep # #choice = NotificationChoice.objects.get(pk = req.POST.get("notification_type","")) #notification.notification_type = choice # #point = SamplingPoint.objects.get(pk = req.POST.get("sampling_point","")) #notification.sampling_point = point # #notification.digest = req.POST.get("digest","") # # ## save the changes to the db #notification.save() #transaction.commit() # ## full-page notification #return message(req, #"SMS notification %s a