私が作成した後、移行しようとするとこのエラーが発生します。 mathfieldはINSTALLED_APPSにインストールされています。AttributeError: 'module'オブジェクトに 'MathField'属性がありません
from django.db import models
from django.utils import timezone
import mathfield
class Post(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharField(max_length=200)
text = models.TextField()
latex = mathfield.MathField(default=timezone.now)
created_date = models.DateTimeField(default=timezone.now)
published_date = models.DateTimeField(
blank=True, null=True)
def publish(self):
self.published_date = timezone.now()
self.save()
def __str__(self):
return self.title
ジャンゴ-mathfieldは私のvirtualenvの django-mathfield usage 私はmakemigrations時の一回限りのデフォルトを許可した場合、エラーがデフォルトで起こるかに設置されています。
私は、Djangoの1.8にあったが、ダウングレードした後、私はまだ同じを取得しますインポートエラー。私は他の何かを試して、それが動作するかどうかを見ます。私はPython 2.7とDjango 1.7を使用しています。 – Rider