Hi,

The error I get is the following:

AttributeError at /admin/jewellery/ring/add/

'Ring' object has no attribute '_get_subtype'

Hence why I tried adding in my own subtype. To be honest, I am not
trying to achieve anything other than to make the error go away :)
Having had a look at the satchmo source code though, I did get to
thinking that subtypes might be a good way to use custom views for
certain product types further on down the line, but in this particular
instance I don't think I will need that.

On May 4, 5:29 pm, Bob Waycott <[email protected]> wrote:
> Benjamin,
> What is the purpose you are trying to achieve with _get_subtype()? And what
> is the AttributeError you receive when you leave it out?
>
> Thanks,
>
> Bob
>
> On Mon, May 4, 2009 at 11:48 AM, Benjamin Edwards <[email protected]
>
> > wrote:
>
> > Hi all,
>
> > I am trying to implement a custom product module, and ideally I would
> > like to do it via model inheritance à la <a href="http://
> > thisismedium.com/labs/satchmo-diaries-part-one/">Bob Waycott</a>.
> > Unfortunately I have hit some snags. Before I go any further, here is
> > the model..
>
> > <pre>
> > class Ring(Product):
> >    objects = ProductManager()
>
> >    multiplier = models.DecimalField(max_digits=5,decimal_places=3)
> >    profile_code = models.ForeignKey('Profile')
> >    metal = models.ForeignKey('Metal')
>
> >    def _get_subtype(self):
> >        return 'Ring'
>
> >    def __unicode__(self):
> >        return u"Ring: %s" % self.name
>
> >    class Admin:
> >        pass
>
> >    class Meta:
> >        verbose_name = _('Ring')
> >        verbose_name_plural = _('Rings')
> > </pre>
>
> > If I leave off _get_subtypes I get an attribute error, if I leave it
> > in I blow the stack off with the a max recursion error. It is getting
> > trapped in the following function call: add_template_context, and the
> > error is being called on this line "context =
> > subtype.add_template_context(context, *args, **kwargs)"  (line 1098 in
> > product/models.py). I have tried to glean an understanding of what the
> > subtype is used for by going through the code, but I have to admit I'm
> > stumped as to how to fix the problem.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Satchmo users" 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/satchmo-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to