hagan
unread,Jul 1, 2009, 7:51:38 PM7/1/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I'm using python 2.6.2, django 1.1-beta-1 with mod_wsgi 2.5.... So
this very well could be a beta bug...
I'm having a strange problem, which I've tracked down to my
UserProfile model... well, the admin interface.
Basically I'm trying to do something like this.... (Simplified from
working model)
-----------------------models.py----------------------------
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.admin import UserAdmin
class UserProfile(models.Model):
someinfo = models.CharField(max_length=128)
def __unicode__(self):
return self.someinfo
class SomeModel(models.Model):
date = models.DateField()
@property
def due_date(self):
return datetime.today()
admin.site.unregister(User)
class UserProfileInline(admin.StackedInline):
model=UserProfile
class UserProfileAdmin(UserAdmin):
inlines = [ UserProfileInline ]
admin.site.register(User, UserProfileAdmin) #<====== That results
in errors....
------------------------/
models.py---------------------------------------
So, I can get UserProfile included in the UserAdmin page.. That works,
however every time I load the wsgi thread I get an error:
"The model User is not registered"
And on the 2nd page refesh, that error goes away. I had chalked that
up as an annoyance up until it became obvious something with my inline
is causing issues with datetime.today() as well.
Without the admin.site.register override datetime.today() works...
With it I get:
Exception Value: 'NoneType' object has no attribute 'today'
Exception Location: /home/webby/add/dilettante/models.py in due_date,
line 120
I'm hoping someone else has seen this error or recognizes that i've
done something obviously wrong.