Comments (10)
Could you post the document that produces the error? My guess is that there is an error in the first if
in get_inline_instances
.
from django-mongoadmin.
I'm getting a similar error, except mine days "NoneType' object has no attribute 'document_type'". Perhaps bad data is causing this.
My fix was to change the if statement at line 346:
if hasattr(f, 'field') and f.field:
embedded_document = f.field.document_type
elif hasattr(f, 'document_type'):
embedded_document = f.document_type
else:
continue
from django-mongoadmin.
Could you give me the definition of the document that causes this error? Because I don't see how and why an EmbeddedDocumentField
can be None. But it may well be I'm overlooking something here. And while your fix certainly works, I guess it could lead to missing InlineAdmins for some documents.
from django-mongoadmin.
What's the easiest way to view a the contents of a document? Printing just tells me what class it is.
from django-mongoadmin.
print obj.__dict__
prints out all the attributes of the object. Mongoengine keeps all the data in the obj.data
(or something similar) dict. None
is usually assigned to data that is defined on the document schema, but not stored in the database.
from django-mongoadmin.
{'_data': {'motherID': None, 'families': [], 'tags': [], 'personal': None, 'fatherID': None, 'childrenIDs': [], 'missing': None, 'api_id': None, 'events': None, 'note': None, 'cached': False, 'api': None, 'relation': None, 'user': None, 'spouseID': None, 'synced': datetime.datetime(2012, 2, 15, 11, 47, 49, 316099), 'parents': [], 'ordinances': None, 'id': None}, '_initialised': True}
from django-mongoadmin.
Thanks for the data. Sadly it helps little without the schema. My attempts at recreating the error have so far failed miserably.
from django-mongoadmin.
class Person(Document):
user = ReferenceField('User',required=True)
# valid api values are "nfs"
api = StringField(max_length=50,required=True)
api_id = StringField(max_length=10,required=True)
cached = BooleanField(default=False)
synced = DateTimeField(default=datetime.datetime.now)
personal = EmbeddedDocumentField(Personal)
events = EmbeddedDocumentField(Events)
ordinances = EmbeddedDocumentField(Ordinances)
families = ListField(EmbeddedDocumentField(Family))
parents = ListField(EmbeddedDocumentField(Parents))
missing = EmbeddedDocumentField(Missing)
relation = StringField()
motherID = StringField(max_length=10)
fatherID = StringField(max_length=10)
# spouse and children should eventually be kept as part of a family
spouseID = StringField(max_length=10)
childrenIDs = ListField()
tags = ListField()
note = StringField()
from django-mongoadmin.
I found more documents that cause the problem:
'NoneType' object has no attribute 'document_type'
{'admin_site': <mongoadmin.sites.AdminSite object at 0x2770c50>, 'model': <class 'family.models.Person'>, 'document': <class 'family.models.Person'>, 'inline_instances': [<mongoadmin.options.EmbeddedStackedDocumentAdmin object at 0x2e945d0>], 'opts': <mongodbforms.documentoptions.DocumentMetaWrapper object at 0x2e944d0>}
'NoneType' object has no attribute 'document_type'
{'admin_site': <mongoadmin.sites.AdminSite object at 0x2770c50>, 'model': <class 'family.models.Person'>, 'document': <class 'family.models.Person'>, 'inline_instances': [<mongoadmin.options.EmbeddedStackedDocumentAdmin object at 0x2e945d0>, <mongoadmin.options.EmbeddedStackedDocumentAdmin object at 0x2e947d0>], 'opts': <mongodbforms.documentoptions.DocumentMetaWrapper object at 0x2e944d0>}
Are these documents that the admin module uses?
from django-mongoadmin.
@justincy Mongoadmin does not have any documents. Your data appears to be the admin object itself.
I've added your fix in the last commit, so that should close that.
from django-mongoadmin.
Related Issues (20)
- Circular Import Error HOT 1
- "You don't have permission to edit anything" HOT 9
- cannot import name LOOKUP_SEP
- cannot import name MAX_SHOW_ALL_ALLOWED HOT 9
- Maximum recursion exceeded with a ReferenceField('self') in Document HOT 1
- Crash when there is no relational database at all HOT 7
- `raw_id_fields` crashing HOT 22
- ImportError: No module named 'mongoadmin.contenttypes' HOT 1
- TypeError: patch_document() got an unexpected keyword argument 'bound' HOT 7
- Exceptions using mongoadmin.auth and mongoadmin.form HOT 4
- 'DatabaseWrapper' object has no attribute 'Database' HOT 3
- 'PermissionManager' object has no attribute 'clone' HOT 3
- AttributeError: 'module' object has no attribute 'User'
- Please, example app with preconfigured settings
- mongo importerror: cannot import name get_verbose_name HOT 3
- clear HOT 2
- ImportError: cannot import name 'update_wrapper' HOT 1
- patch to fix saving error related to missing new_objects attribute HOT 1
- I get an error when I start server
- Django version 1.9 above, we are getting this problem HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-mongoadmin.