Hey, Thanks for the reply. I should have mentioned this in the previous post, but I *did* get rid of the _get_sub_type method, for all of the reasons you mentioned. I only put it in because not having it there was giving me an error to start with! The trace back I posted was using a model with no get sub types of any kind on it, like so: http://python.pastebin.com/f7b558095 . That gave me the traceback posted above.
On May 12, 2:49 pm, Bob Waycott <[email protected]> wrote: > I'm still not understanding why you even have _get_subtype() > A couple things to point out ... you are receiving the error because Satchmo > is trying to lookup Ring._get_subtype as an attribute ... but you have > defined it as a method, which means it should be called as > Ring._get_subtype(). If you don't know why you have it in there, then take > it out. You should not need it -- particularly when you have no idea why its > even in there. Never add a line of code to a project that you don't > understand and know why it is there. ;) > > So, my suggestion, unless you can explain your reason for having the method > there, is to get it out of your Ring class. You're likely getting a max > recursion error because you are returning the Ring class in _get_subtype() > ... not something you want to do, and further shows that you don't really > have a purpose for having it in there. > > So ... cut it out and then let us know what kind of error you receive with a > Traceback. > > Thanks, > > Bob > > On Mon, May 11, 2009 at 4:29 PM, Benjamin Edwards <[email protected] > > > wrote: > > > Hi, sorry! Have been slapped at work, haven't been able to dedicate > > any time to this :( I really appreciate your time. > > >http://python.pastebin.com/f32359bfb > > > is the full trace back for the attribute error. > > > On 7 May, 01:31, Bob Waycott <[email protected]> wrote: > > > The Traceback would still be useful ... but I neglected to take another > > look > > > at your first post where you try to point out where the error is > > occurring. > > > However, a complete Traceback, even if you just post it to pastebin or > > > dpaste and give us a link here would at least give us more to look at. > > > Thanks. > > > > On Wed, May 6, 2009 at 8:29 PM, Bob Waycott <[email protected]> > > wrote: > > > > Perhaps a complete Traceback would be more helpful. > > > > Do you know where _get_subtype() is being called on the Ring object? If > > you > > > > find that, you will likely find your error. > > > > > On Wed, May 6, 2009 at 5:19 PM, Benjamin Edwards < > > > > [email protected]> wrote: > > > > >> 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 -~----------~----~----~----~------~----~------~--~---
