Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango cannot import name x
    text
    copied!<p>I got an error I don't understand !</p> <p><em>cannot import name Item</em></p> <p>In my model, I have items. These items are required for actions. But some of these items have an effect on actions :</p> <p><strong>items</strong></p> <pre><code>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' </code></pre> <p><strong>actions</strong></p> <pre><code>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 craft' class Meta: verbose_name_plural = 'crafts actions' </code></pre> <p><strong>effects</strong></p> <pre><code>from django.db import models from actions.models import Action class Effect(models.Model): action = models.ForeignKey class ApEffect(Effect): ap = models.IntegerField() </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload