-
-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Getting error while saving model from admin having nested embedded documents #136
Comments
It seems that djongo (or Django itself, which the abstract attribute is coming from) does not allow to embed an abstract model inside another abstract model (ie, max deep <= 2), although there are not such limitations in MongoDB and pymongo |
Any way to get over this limitation? |
I am facing the same problem, does anyone have a solution? |
4 similar comments
I am facing the same problem, does anyone have a solution? |
I am facing the same problem, does anyone have a solution? |
I am facing the same problem, does anyone have a solution? |
I am facing the same problem, does anyone have a solution? |
still didnt solve it? :( |
@nesdis can you help us? Is there a way around this? Thanks. |
@nesdis now the django admin is messed up. Is therere any way to fix this? |
@aryan340 This package is mostly unusable, just use Pymongo. however check your Django version. If it's Django 3+ this might have broke djongo integration. |
Then why are you using mongoDB? |
guys, I really don't understand this but when I change the name of EmbededField in my model (without migrations) I have access to the rest of the instances of that model in admin UI! |
I have a model which has nested embedded documents. While saving from admin UI following error is raised - 'list' object has no attribute '_meta'
Model looks like below , while debugging , it was found that 2nd level of nested document is raising exception. If contents of dimensions is moved under shipping , this works fine
{
"productId": "P1020",
"productName": "Product_52956",
"shipping": {
"dimensions": {
"height": 8.2787,
"length": 7.3324,
"width": 4.6937
},
"weight": 2.2756
}
}
Python script
Traceback
Internal Server Error: /admin/CatalogApp/product/add/
\n{ model_form.as_table() }\nTraceback (most recent call last):
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\core\handlers\exception.py", line 35, in inner
response = get_response(request)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\core\handlers\base.py", line 158, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\core\handlers\base.py", line 156, in _get_response
response = response.render()
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\response.py", line 106, in render
self.content = self.rendered_content
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\response.py", line 83, in rendered_content
content = template.render(context, self._request)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\backends\django.py", line 61, in render
return self.template.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 175, in render
return self._render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 167, in _render
return self.nodelist.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 943, in render
bit = node.render_annotated(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\loader_tags.py", line 155, in render
return compiled_parent._render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 167, in _render
return self.nodelist.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 943, in render
bit = node.render_annotated(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\loader_tags.py", line 155, in render
return compiled_parent._render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 167, in _render
return self.nodelist.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 943, in render
bit = node.render_annotated(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\loader_tags.py", line 67, in render
result = block.nodelist.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 943, in render
bit = node.render_annotated(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\loader_tags.py", line 67, in render
result = block.nodelist.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 943, in render
bit = node.render_annotated(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\defaulttags.py", line 211, in render
nodelist.append(node.render_annotated(context))
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\loader_tags.py", line 194, in render
return template.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 177, in render
return self._render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 167, in _render
return self.nodelist.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 943, in render
bit = node.render_annotated(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\defaulttags.py", line 211, in render
nodelist.append(node.render_annotated(context))
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\defaulttags.py", line 211, in render
nodelist.append(node.render_annotated(context))
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\defaulttags.py", line 314, in render
return nodelist.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 943, in render
bit = node.render_annotated(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\defaulttags.py", line 314, in render
return nodelist.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 943, in render
bit = node.render_annotated(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 910, in render_annotated
return self.render(context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 999, in render
return render_value_in_context(output, context)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\template\base.py", line 978, in render_value_in_context
value = str(value)
File "C:\Users\611834094\AppData\Roaming\Python\Python36\site-packages\djongo\models\fields.py", line 568, in str
return mark_safe(f'
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\forms\forms.py", line 279, in as_table
errors_on_separate_row=False)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\forms\forms.py", line 238, in _html_output
'field_name': bf.html_name,
File "C:\Users\611834094\AppData\Roaming\Python\Python36\site-packages\djongo\models\fields.py", line 566, in str
model_form = self.field.model_form_class(instance=instance, **self.field.model_form_kwargs)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\forms\models.py", line 291, in init
object_data = model_to_dict(instance, opts.fields, opts.exclude)
File "C:\Users\611834094\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-2.0.2-py3.6.egg\django\forms\models.py", line 82, in model_to_dict
opts = instance._meta
AttributeError: 'list' object has no attribute '_meta'
[22/May/2018 21:00:52] "POST /admin/CatalogApp/product/add/ HTTP/1.1" 500 402143
The text was updated successfully, but these errors were encountered: