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
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,
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
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
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
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
6 matches
Mail list logo