我使用django-primate。我用3个新字段覆盖标准用户类:
from primate.models import UserBase, UserMeta
from django.db import models
class CustomUser(UserBase):
__metaclass__ = UserMeta
name = models.CharField(max_length=500, default='Jon Deg')
jabber_id = models.CharField(max_length=150, default='jabber@jabber.org')
title = models.CharField(max_length=20, blank=True)
当然,添加admin.py:
from primate.admin import UserAdminBase
from django.contrib import admin
from django.contrib.auth.models import User
class UserAdmin(UserAdminBase):
pass
admin.site.register(User, UserAdmin)
现在在django-admin中我只能管理'name'和其他一些标准的auth字段。我怎样才能将jabber_id添加到django-admin?