I can not for the life of me figure out why my list_display works when the 
django server is in DEBUG=True but not when it is in DEBUG=False. I am 
using Django 1.4.3 (mod_wsgi 3.4/Python 2.7) 


 Here is the partial stack trace...


  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/manager.py", 
line 116, in all
    return self.get_query_set()

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/fields/related.py",
 
line 565, in get_query_set
    return super(ManyRelatedManager, self).get_query_set().using(
db)._next_is_sticky().filter(**self.core_filters)

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/query.py", 
line 624, in filter
    return self._filter_or_exclude(False, *args, **kwargs)

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/query.py", 
line 642, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/sql/query.py", 
line 1250, in add_q
    can_reuse=used_aliases, force_having=force_having)

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/sql/query.py", 
line 1122, in add_filter
    process_extras=process_extras)

  File 
"/home/difuzi0n/webapps/wedding/lib/python2.7/django/db/models/sql/query.py", 
line 1316, in setup_joins
    "Choices are: %s" % (name, ", ".join(names)))

*FieldError: Cannot resolve keyword 'rsvp_guests' into field. Choices are: 
city, event, first_name, id, last_name, state, street, zip_code*

My models looks as follows...

class Guest(models.Model):
    first_name = models.CharField(max_length=50,
                                  help_text="The Guest's given name.")
    last_name = models.CharField(max_length=50,
                                 help_text="The Guest's surname.")
                     ...
    def __unicode__(self):
        return u'{} {}'.format(self.first_name, self.last_name)

class RSVP(models.Model):
    event = models.ForeignKey(Event, verbose_name='RSVP Event')
    guests = models.ManyToManyField(Guest, verbose_name='Guests',
                                    related_name='rsvp_guests',
                                    limit_choices_to = { 'id__in': 
Event.objects.all().values('guests').query })
                    ...

and the admin.py entry looks like so:

def guest_names(obj):
   return u', '.join([unicode(guest) for guest in obj.guests.all()])

class RSVPAdmin(admin.ModelAdmin):
    list_display = ['event', guest_names, 'max_invites', 'response',
                    'response_datetime', 'updated_by']
    filter_horizontal = ('guests', )


thanks, in advance, for your help!!!

/Eric

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to