Pinax と Django は初めてです。プラグインした別のアプリケーション (この場合は django-swingtime : http://code.google.com/p/django-swingtime/ )からプルする OneToOneField を使用して、Pinax プロファイル モデルを拡張しようとしています。すべてのモデルを django 管理インターフェイスに表示しましたが、新しいユーザーを追加できません (これは、新しいプロファイルを追加する過程で行いたいことです)。次のエラーが表示されます。
IntegrityError at /admin/auth/user/add/
profiles_profile.event_type_id may not be NULL
Request Method: POST
Request URL: http://localhost:8000/admin/auth/user/add/
Django Version: 1.3.1
Exception Type: IntegrityError
Exception Value:
profiles_profile.event_type_id may not be NULL
私の Pinax のバージョンは 0.9a2 です。EventType は django-swingtime のモデルです。Django admin 内の任意の場所からユーザーを追加しようとすると、このエラーが発生します。
これが私の Profiles/models.py です (変更された行の横にコメントがあります)
from django.db import models
from django.utils.translation import ugettext_lazy as _
from idios.models import ProfileBase
from swingtime.models import EventType #ADDED HERE
class Profile(ProfileBase):
name = models.CharField(_("name"), max_length=50, null=True, blank=True)
about = models.TextField(_("about"), null=True, blank=True)
location = models.CharField(_("location"), max_length=40, null=True, blank=True)
website = models.URLField(_("website"), null=True, blank=True, verify_exists=False)
event_type = models.OneToOneField(EventType) #ADDED HERE
def __unicode__(self):
return "Name: %s -- %s" % (self.name, self.about) #ADDED HERE
おそらく、誰かがアカウント、プロファイル、およびユーザー間の関係と、どのファイルを編集してもよいか、どのファイルを編集することをお勧めしないかを説明できればと思います (たとえば、Pinax サイト パッケージで何かを変更したいとは思いません. ..)、私はいくつかの進歩を遂げることができます。また、この idios プラグインがプロセスに関与していると思いますが、私が見つけたドキュメントへのリンクが読み込まれます (http://oss.eldarion.com/idios/docs/0.1/)。
ありがとうございました!