Ok your idea worked just fine, but i keep coming up with new
questions :)

The result of it was that when i opened poll i got poll with name
<django.contrib.contenttypes.generic.GenericRelatedObjectManager
object at 0x9702e8c>

So i wrote something (i dont know how its called - model instance?
model manager?) to retrieve the actual value of translation and my
poll model looks like this now :
class Poll(models.Model):
        name = generic.GenericRelation(Trans)
        pub_date = models.DateTimeField('date published')
        active = models.BooleanField()
        def __unicode__(self):
                return unicode(self.name)
        def tname(self):
                q = Trans.objects.filter(poll = self)
                q = q.get(keel = 1)
                t = q.name
                return t

Can this query also be shorter? and better? cause the first line seems
not to filter out anything at all.

Another one - this might solve the problem for displaying poll names
in list view, but when im creating questions for this poll, then in
the selectbox where i choose to which poll question belongs to i still
have poll name as
<django.contrib.contenttypes.generic.GenericRelatedObjectManager
object at 0x9702e8c>.
How could that be changed? Can it be changed withing admin.py of my
app?

Alan

On Apr 14, 3:45 pm, matehat <mathieu.damo...@gmail.com> wrote:
> Sorry about the last post (was a little tired from a sleepless night
> of solving problems in physics ...). I think you can solve the issue
> by putting "return unicode(self.name)" instead of "return self.name"
> in all of the __unicode__ method of your models. The things is that
> you must make sure to return unicode object in that method.
>
> Another thing that pops in my mind from inspecting your code is that
> line in TranslationInline,
>
> >class TranslationInline(generic.GenericTabularInline):
> >        model = Trans
> >        extra = len(lang.objects.all())
>
> where it would be more efficient to do :
>
> extra = lang.objects.count()
>
> But that's just optimization stuff...
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to