Re: Strange error overriding changelist_view in ModelAdmin

2010-08-04 Thread Steve Holden
On 8/4/2010 5:43 AM, Erisa wrote: > Oops! I copied the old class with the "self" mistake left in. The > correct class is: > > class SettingsAdmin(admin.ModelAdmin): > def changelist_view(self, request, extra_context=None): > object_id = str(Settings.objects.all()[0].id) > retu

Re: Strange error overriding changelist_view in ModelAdmin

2010-08-04 Thread Erisa
Oops! I copied the old class with the "self" mistake left in. The correct class is: class SettingsAdmin(admin.ModelAdmin): def changelist_view(self, request, extra_context=None): object_id = str(Settings.objects.all()[0].id) return super(SettingsAdmin, self).change_view(self,

Re: Strange error overriding changelist_view in ModelAdmin

2010-08-03 Thread Erisa
I found the problem. The object_id needs to be a string! So the following works like a charm: from wolkdata.database.models import * from django.contrib import admin class SettingsAdmin(admin.ModelAdmin): def changelist_view(self, request, extra_context=None): object_id = str(Settin

Re: Strange error overriding changelist_view in ModelAdmin

2010-08-03 Thread Erisa
I can't believe I missed the "self" problem, but when I fixed that I still received another strange error: Traceback: File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/ base.py" in get_response 100. response = callback(request, *callback_args, **callback_kwarg

Re: Strange error overriding changelist_view in ModelAdmin

2010-08-03 Thread natebeacham
Try not passing "self" to your super call. That parameter should be handled internally. ie: return super(SettingsAdmin, self).change_view(request, object_id, extra_context=None) On Aug 3, 8:26 pm, Erisa wrote: > I have a Settings model that contains settings for my application. > > class Setting

Strange error overriding changelist_view in ModelAdmin

2010-08-03 Thread Erisa
I have a Settings model that contains settings for my application. class Settings(models.Model): database_name = models.CharField(max_length=50) current_campaign = models.ForeignKey('Campaign') It only contains one object. I would like to be able to use the admin pages to edit it. Since