I'm sorry, I messed up my foos and bars. Let me try again. (Not using
foo nor bar).
I have a Component object, a Version object and a Data object (that
holds additional data about the version object). They look like
this::
class Component(models.Model):
name = models.CharField(maxlenth=30)
...
class Version(models.Model):
component = models.ForeignKey(Component)
version = models.CharField(maxlength=30)
...
class Data(models.Model):
meta_data = models.CharField(maxlength=30)
version = models.ForeignKey(Version)
Now given a component, I want to get all the version instances and
alll the data associated with it. So I do something like this:
for version in component_instance.version_set.all():
for data in version.data_set.all():
#adjust meta_data on data
AttributeError at /myapp/
'Version' object has no attribute 'data_set'
Request Method: GET
Request URL: http://localhost:8000/myapp/
Exception Type: AttributeError
Exception Value: 'Version' object has no attribute 'data_set'
Exception Location: /home/matt/.views.py in _add_metadata, line 293
So this is the weird thing. Accessing _set.all() works on the
component_instance, but fails on the next line... Is _set.all() no
longer returning instances? Again, this worked before updating svn.
-matt
On 7/5/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote:
>
> On Wed, 2006-07-05 at 22:50 -0600, m h wrote:
> > I'll just post the contents of my bug report. Has anyone else ran
> > into this? Any hints, suggestions?
> >
> >
> > http://code.djangoproject.com/ticket/2297
>
> This isn't a bug. You are using foo_set incorrectly (it is not an
> attribute on the Bar model, as the error indicates). Either bar.foo or
> foo_instance.foo_set is what you want to use.
>
> Regards,
> Malcolm
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---