Thursday, August 28, 2014

Re: New user - struggling with database design

Ok - here is where I am stuck now. Any thoughts?

If I try to render {{ vessel.CurrentBrew }} in a view, I get something like this:
<django.db.models.fields.related.ManyRelatedManager object at 0x7f76f0088e10>

and this errors out:

{% for Brew in vessel.CurrentBrew.all %}X{{ Brew.ActualName }}<br/>{% endfor %}

(1146, "Table 'dbLunawireBrewing.brewlog_vessel_CurrentBrew' doesn't exist")


The vessel model looks like this:
class Vessel(models.Model):      Name = models.CharField(max_length=20)      ShortName = models.CharField(max_length=4)      Gallons = models.DecimalField(max_digits=4, decimal_places=2, null=True, blank=True)      Weight = models.DecimalField(max_digits=4, decimal_places=2, null=True, blank=True)      CurrentBrew  = models.ManyToManyField('Brew', related_name="brew")      def __unicode__(self):          return self.Name  

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2363ed3e-a787-46a0-b887-7706d0a9c315%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment