2

这是我的forms.py:

from django import forms
from .models import Position, PositionRelForm

class PositionForm(forms.ModelForm):
    class Meta:
        model = Position
        fields = '__all__'

class PositionRelForm(forms.ModelForm):
    class Meta:
        model = PositionRel
        fields = '__all__'

这是我的models.py

from django.db import models
from datetime import datetime
from django_neomodel import DjangoNode
from neomodel import StructuredNode, StringProperty, DateTimeProperty, UniqueIdProperty, Relationship, StructuredRel
from django.core.urlresolvers import reverse

class PositionRel(StructuredRel):
    since = DateTimeProperty(default=lambda: datetime.now(pytz.utc))
    distance = StringProperty()
    class Meta:
        app_label = 'highways'

class Position(DjangoNode):
    kind = StringProperty(unique_index=True)
    created_at = DateTimeProperty(default=datetime.utcnow)
    road_to = Relationship('Position','ROAD_TO', model=PositionRel)
    class Meta:
        app_label = 'highways'

    def get_absolute_url(self):
        return reverse('position_list')

当我运行服务器时,出现此错误:

AttributeError:类型对象“位置”没有属性“_meta”

4

0 回答 0