Error Was Cannot Import Name New Forms
Contents |
från GoogleLogga inDolda fältSök efter grupper eller meddelanden
here for a quick overview of the site Help Center Detailed answers to any questions django resolve circular import you might have Meta Discuss the workings and policies of this django import model from another app site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers django no module named or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a https://groups.google.com/d/topic/django-users/XfkywqovqMo community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up cannot import form in django up vote 0 down vote favorite I am facing annoying problem.. i was trying to extend user registation with custom fields... as below import hashlib import datetime import http://stackoverflow.com/questions/11788182/cannot-import-form-in-django hmac from django.db import models from django.contrib.auth.models import User from ecpCommon.models import StateModel from ecpCommon.enum import enumauto from ecpPayments.models import PaymentCard from registration.signals import user_registered from apps.ecpUser.models import UserProfile from apps.ecpMerchant.forms import RegistrationFormEx class MerchantProfile(StateModel): user = models.OneToOneField(UserProfile, related_name="merchant_profile") payment_card = models.OneToOneField(PaymentCard, related_name="merchant_profile") current_state = models.IntegerField('State', choices=STATE_CHOICES) name = models.CharField('Merchant Name', max_length=64) def user_created(sender, user, request, **kwargs): form = RegistrationFormEx(data=request.POST) new_user = User.objects.get(username=request.POST['username']) digest=hmac.new("qnscAdgRlkIhAUPY44oiexBKtQbGY0orf7OV1I50", str(request.POST['password1']),hashlib.sha1).hexdigest() new_profile = UserProfile(user=new_user,api_key=digest) new_profile.save() #now add other fields including password hash as well uid = new_profile.id merchant_profile = MerchantProfile(user_id=uid, create_time=datetime.datetime.now(), modified_time=datetime.datetime.now(), payment_card_id=uid, current_state=1, name=request.POST['name'], ) merchant_profile.save() my forms is as follow from django import forms from registration.forms import RegistrationForm from django.utils.translation import ugettext_lazy as _ from registration.models import RegistrationProfile from apps.ecpMerchant.models import Category class RegistrationFormEx(RegistrationForm): #ADD ALL CUSTOM FIELDS BELOW name=forms.CharField() but it is showing following error log.. earlier it was working .. later the error came.. i have several modification in models with other tables... but how it effect this registration C:\Python27\Lib\site-packages\django
here for a quick overview of the site Help Center Detailed answers to http://stackoverflow.com/questions/7684408/django-cannot-import-name-x any questions you might have Meta Discuss the workings and https://github.com/redsolution/django-generic-ratings/issues/1 policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community cannot import Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Django cannot import name x up vote 25 down vote favorite 8 I got an error I don't understand ! cannot import name Item In my model, cannot import name I have items. These items are required for actions. But some of these items have an effect on actions : items from django.db import models from effects.models import Effect class Type(models.Model): name = models.CharField(max_length=200) def __unicode__(self): return self.name class Item(models.Model): name = models.CharField(max_length=200) description = models.CharField(max_length=200) type = models.ForeignKey(Type) quality = models.IntegerField() effects = models.ManyToManyField(Effect,through='ItemEffect',blank=True) item_requirement = models.ManyToManyField('self',through='ItemCraft',symmetrical=False,blank=True) points = models.IntegerField() def __unicode__(self): return self.name class Food(Item): ap = models.IntegerField() class Tool(Item): durability = models.IntegerField() [....] class ItemEffect(models.Model): item = models.ForeignKey(Item) effect = models.ForeignKey(Effect) def __unicode__(self): return self.item.name+':'+str.lower(self.effect.name) class Meta: verbose_name_plural = 'items effects' class ItemCraft(models.Model): item = models.ForeignKey(Item,related_name='%(class)s_item_crafted') item_requirement = models.ForeignKey(Item,related_name='%(class)s_item_required') number = models.IntegerField() def __unicode__(self): return self.item.name+' requires '+str.lower(self.item.name)+'('+self.number+')' class Meta: verbose_name_plural = 'items crafts' actions from django.db import models from items.models import Item class Action(models.Model): name = models.CharField(max_length=200) description = models.CharField(max_length=200) pa = models.IntegerField() def __unicode__(self): return self.name class CraftAction(Action): item = models.ForeignKey(Item) def __unicode__(self): return self.item.name+'\'s cr
Sign in Pricing Blog Support Search GitHub This repository Watch 12 Star 8 Fork 3 redsolution/django-generic-ratings Code Issues 1 Pull requests 0 Projects 0 Pulse Graphs New issue Can't import ratings.view, can not import name forms? #1 Closed bschollnick opened this Issue Sep 8, 2011 · 2 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 1 participant bschollnick commented Sep 8, 2011 Folks, I'm new to Django, so I suspect that I have missed something... But I have followed the install process, and when I go to now open a page on my Django app, I am getting an error: ViewDoesNotExist at /accounts/bschollnick3/activate/bed5f5b57666dc2515684f8cd7155d9396ecc90e/ Could not import ratings.views. Error was: cannot import name forms Request Method: GET Request URL: http://127.0.0.1:8000/accounts/bschollnick3/activate/bed5f5b57666dc2515684f8cd7155d9396ecc90e/ Django Version: 1.3 Exception Type: ViewDoesNotExist Exception Value: Could not import ratings.views. Error was: cannot import name forms As far as I can tell, everything is configured right... Any suggestions? bschollnick commented Sep 8, 2011 Template error In template /Users/Benjamin/dropbox/Programming/django/Versions2/VersionCheck/templates/indigo-plugin-details.html, error at line 40 'ratings_tags' is not a valid tag library: ImportError raised loading ratings.templatetags.ratings_tags: cannot import name forms 30 31 32 33 Author's WebSite {{ IndigoPlugin.author.Authorwebsite }} 34 35 36 37 Author'sEmail {{ IndigoPlugin.author.Author_email }} 38 39 40 {% load ratings_tags %} 41 42 {% get_rating_score for film as score %} 43 44 {% if score %} 45 Average score: {{ score.average|floatformat }} 46 Number of votes: {{ score.num_votes }} 47 {% else %} 48 How sad: nobody voted {{ film }} 49 {% endif %} 50 Environment: Request Method: GET Request URL: http://127.0.0.1:8000/Details/External%20IP%20Address%20&%20Dynamic%20DNS%20Updater Django Version: 1.3 Python Version: 2.7.1 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.humanize', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'easy_thumbnails', 'guardian', 'ratings', 'use