What I am trying to do is reproduce your problem. So I laid out two simple
classes:

CHOICES = (
    (1,'Choice 1'),
    (2, 'Choice 2')
)

class FirstClass(models.Model):
    parent = models.ForeignKey('self', blank=True, null=True)
    choicelist = models.PositiveSmallIntegerField(choices=CHOICES)

class SecondClass(models.Model):
    parent = models.ForeignKey('self', blank=True, null=True)
    choice = models.ForeignKey(FirstClass)

in which I am trying to get to the problem. In the shell I am able to see
what is going on:

>>> a = FirstClass(choicelist=1)
>>> a.save()
>>> b = SecondClass(choice=a)
>>> b.save()
>>> b.choice.get_choicelist_display()
u'Choice 1'

This test does exactly what it is supposed to do.

I still am missing what is causing this error. It is most likely happening
in a loop of some sort, which is somewhere else in your template. Is there a
loop in you template? Go into the shell and try to extract the data from the
user object like above. My bet is that that api works exactly like you
expect it to. There is something else. Is there anymore traceback? Try to
reproduce in the shell, that will help us pinpoint exactly where the error
is coming from.

One more thing: What are you doing with class Import? That doesn't make any
sense like that to me.

Also, I realize that the fact that you are using the QS-RF branch is
important for us to know what base code you are working from, but this is
the second post you have posted that doesn't really have anything specific
to that branch. You will get more people to help you out if you leave that
out of the subject and mention it inside the body of the message where it
becomes apparent that the problem is not QS-RF specific.




On Tue, Apr 15, 2008 at 10:59 AM, sector119 <[EMAIL PROTECTED]> wrote:

>
> Template error
>
> In template /home/sector119/devel/eps_src/eps/templates/base.html,
> error at line 23
> Caught an exception while rendering: maximum recursion depth exceeded
> in cmp
>
> 23      <b>{{ user.office.location.get_type_display }}.
> 24      {{ user.office.location.name }},
> 25      {{ user.office.name }},
>
> ----------------------
>
> class Location(models.Model):
>    id = models.IntegerField(_('Id'), primary_key=True)
>    parent = models.ForeignKey('self', verbose_name=_('Location parent
> id:'), null=True, blank=True,          related_name='child_set')
>    name = models.CharField(_('Location'), help_text=_('Office or
> person location.'), max_length=32)
>    type = models.PositiveSmallIntegerField(_('Location type'),
> choices=LOCATION_TYPE_CHOICES)
>
>    def __unicode__(self):
>        return self.name
>
>    class Import:
>        pass
>
>    class Meta:
>        verbose_name = _('Location')
>        verbose_name_plural = _('Locations')
>        ordering = ['parent', 'id']
>
>    class Admin:
>        pass
>
>
> ----------------------
>
> class OrganizationOffice(models.Model):
>    parent = models.ForeignKey('self', verbose_name=_('Parent
> office:'), null=True, blank=True)
>    location = models.ForeignKey(Location,
> verbose_name=_('Location:'))
>    name = models.CharField(_('Office'), max_length=50)
>    bank = models.CharField(_('Bank'), max_length=50, null=True,
> blank=True)
>    account = fields.PositiveBigIntegerField(_('Account'), null=True,
> blank=True)
>    bic = models.PositiveIntegerField(_('BIC'), help_text=_('Bank
> identifier code.'), null=True, blank=True)
>    code = models.PositiveIntegerField(_('Code'),
> help_text=_('Enterprise code.'), null=True, blank=True)
>    in_testmode = models.BooleanField(_('Office is in test mode'),
> default=False)
>    day_is_open = models.BooleanField(_('Transaction day is open'),
> default=False)
>
>    def __unicode__(self):
>        return self.name
>
>    class Import:
>        pass
>
>    class Meta:
>        verbose_name = _('Office')
>        verbose_name_plural = _('Offices')
>        ordering = ['location', 'parent', 'id']
>
>    class Admin:
>        search_fields = ('^id', '^location__name', 'name')
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to