jschrewe / django-mongoadmin

Integrates mongodb into django's admin
http://www.schafproductions.com/projects/mongo-admin/
BSD 3-Clause "New" or "Revised" License
112 stars 38 forks source link

'MetaDict' object has no attribute 'fields' #12

Closed phoolish closed 12 years ago

phoolish commented 12 years ago

Running django 1.3 and latest pull from django-mongoadmin repo. Am I missing something?

here is my admin.py

from mongoadmin import site, DocumentAdmin, InlineDocumentAdmin

from dataportal.models import DataType, Geography, Category

class DataTypeInline(InlineDocumentAdmin):
    document = DataType
    model = DataType

class GeographyInline(InlineDocumentAdmin):
    document = Geography
    model = Geography

class DataPortalDocumentAdmin(DocumentAdmin):
    inlines = [DataTypeInline, GeographyInline]

site.register(Category, DataPortalDocumentAdmin)

And my models.py

    from mongoengine import Document, EmbeddedDocument, EmbeddedDocumentField, StringField, BooleanField, ListField, ReferenceField, IntField, FloatField, ValidationError, queryset_manager, PULL, DENY

    class DataType(Document):
        name = StringField(max_length=120, required=True, unique=True)
        description = StringField()
        quarter = BooleanField(default=False)
        datatype = ListField(ReferenceField('self', reverse_delete_rule=PULL))

        def __unicode__(self):
            return self.name

    class Geography(Document):
        area = StringField(max_length=120)
        geography = ListField(StringField(max_length=120))
        description = StringField()

        def __unicode__(self):
            return self.area

    class Category(Document):
        name = StringField(max_length=120, required=True)
        description = StringField()
        datatype = ListField(ReferenceField(DataType, reverse_delete_rule=PULL))
        geography = ListField(ReferenceField(Geography, reverse_delete_rule=PULL))

        def __unicode__(self):
            return self.name
phoolish commented 12 years ago

Duplicates #9