Repository: allegro/ralph

Issue:
500 internal error
hi
OS ubuntu Buster 

i imported about 900 vms in virtual servers and it have 9 pages now 
i can view 6 pages without problem but in pages 7 - 9 i get this error


Environment:


Request Method: GET
Request URL: http://foo.bar/virtual/virtualserver/?p=6

Django Version: 1.8.19
Python Version: 3.6.7
Installed Applications:
('ralph.admin',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.humanize',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django_rq',
 'import_export',
 'mptt',
 'reversion',
 'sitetree',
 'ralph.accounts',
 'ralph.assets',
 'ralph.attachments',
 'ralph.back_office',
 'ralph.configuration_management',
 'ralph.dashboards',
 'ralph.data_center',
 'ralph.dhcp',
 'ralph.deployment',
 'ralph.licences',
 'ralph.domains',
 'ralph.trade_marks',
 'ralph.sim_cards',
 'ralph.supports',
 'ralph.security',
 'ralph.lib.foundation',
 'ralph.lib.table',
 'ralph.networks',
 'ralph.data_importer',
 'ralph.dc_view',
 'ralph.reports',
 'ralph.virtual',
 'ralph.operations',
 'ralph.lib.external_services',
 'ralph.lib.transitions',
 'ralph.lib.permissions',
 'ralph.lib.custom_fields',
 'ralph.lib.hooks',
 'ralph.notifications',
 'ralph.ssl_certificates',
 'rest_framework',
 'rest_framework.authtoken',
 'taggit',
 'taggit_serializer')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'threadlocals.middleware.ThreadLocalMiddleware')


Template error:
In template /opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/admin/templates/admin/change_list.html, error at line 104
   'NoneType' object has no attribute 'get_absolute_url'

   94 :                 {% include 'admin/partials/filters.html' %}



   95 :               {% endif %}



   96 :             {% endif %}



   97 :           {% endblock %}



   98 :         {% endif %}



   99 :         <div class="small-{% if has_filters %}10{% else %}12{% endif %} columns">



   100 :           {% block result_list %}



   101 :             {% if cl.formset %}



   102 :               {{ cl.formset.management_form }}



   103 :             {% endif %}



   104 :                {% result_list cl %} 



   105 :             {% if action_form and actions_on_bottom and cl.show_admin_actions %}



   106 :               {% admin_actions %}



   107 :             {% endif %}



   108 :           {% endblock %}



   109 :         </div>



   110 : 



   111 :       </div>



   112 : 



   113 :       {% block pagination %}



   114 :         {% pagination cl %}


Traceback:
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/core/handlers/base.py" in get_response
  164.                 response = response.render()
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/response.py" in render
  158.             self.content = self.rendered_content
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/response.py" in rendered_content
  135.         content = template.render(context, self._request)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/backends/django.py" in render
  74.         return self.template.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in render
  210.                     return self._render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in _render
  202.         return self.nodelist.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in render
  905.                 bit = self.render_node(node, context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/template/base.py" in render
  1273.                     _dict = func(*resolved_args, **resolved_kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/templatetags/admin_list.py" in result_list
  320.             'results': list(results(cl))}
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/templatetags/admin_list.py" in results
  296.             yield ResultList(None, items_for_result(cl, res, None))
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/templatetags/admin_list.py" in __init__
  287.         super(ResultList, self).__init__(*items)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/templatetags/admin_list.py" in items_for_result
  199.             f, attr, value = lookup_field(field_name, result, cl.model_admin)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/utils.py" in lookup_field
  278.             value = attr(obj)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/virtual/admin.py" in get_parent
  177.             obj.parent.get_absolute_url(), obj.parent.hostname

Exception Type: AttributeError at /virtual/virtualserver/
Exception Value: 'NoneType' object has no attribute 'get_absolute_url'



Discussion:
i have found several more 500 errors

Environment:


Request Method: GET
Request URL: http://foo.bar/operations/change/

Django Version: 1.8.19
Python Version: 3.6.7
Installed Applications:
('ralph.admin',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.humanize',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django_rq',
 'import_export',
 'mptt',
 'reversion',
 'sitetree',
 'ralph.accounts',
 'ralph.assets',
 'ralph.attachments',
 'ralph.back_office',
 'ralph.configuration_management',
 'ralph.dashboards',
 'ralph.data_center',
 'ralph.dhcp',
 'ralph.deployment',
 'ralph.licences',
 'ralph.domains',
 'ralph.trade_marks',
 'ralph.sim_cards',
 'ralph.supports',
 'ralph.security',
 'ralph.lib.foundation',
 'ralph.lib.table',
 'ralph.networks',
 'ralph.data_importer',
 'ralph.dc_view',
 'ralph.reports',
 'ralph.virtual',
 'ralph.operations',
 'ralph.lib.external_services',
 'ralph.lib.transitions',
 'ralph.lib.permissions',
 'ralph.lib.custom_fields',
 'ralph.lib.hooks',
 'ralph.notifications',
 'ralph.ssl_certificates',
 'rest_framework',
 'rest_framework.authtoken',
 'taggit',
 'taggit_serializer')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'threadlocals.middleware.ThreadLocalMiddleware')


Traceback:
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.6/contextlib.py" in inner
  52.                 return func(*args, **kwds)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/options.py" in wrapper
  618.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
  110.                     response = view_func(request, *args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/sites.py" in inner
  233.             return view(request, *args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/reversion/revisions.py" in do_revision_context
  297.                 return func(*args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/admin/mixins.py" in changelist_view
  141.         response = super().changelist_view(request, *args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/admin/mixins.py" in changelist_view
  313.             request, extra_context
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/admin/mixins.py" in changelist_view
  223.         return super().changelist_view(request, extra_context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/reversion/admin.py" in changelist_view
  419.         return super(VersionAdmin, self).changelist_view(request, context)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
  34.             return bound_func(*args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
  110.                     response = view_func(request, *args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/utils/decorators.py" in bound_func
  30.                 return func.__get__(self, type(self))(*args2, **kwargs2)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/options.py" in changelist_view
  1550.                 self.list_max_show_all, self.list_editable, self)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/admin/views/main.py" in __init__
  14.         super().__init__(request, *args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/views/main.py" in __init__
  47.         self.root_queryset = model_admin.get_queryset(request)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/operations/admin.py" in get_queryset
  99.         qs = super().get_queryset(request)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/lib/permissions/admin.py" in get_queryset
  172.         queryset = super().get_queryset(request)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/admin/mixins.py" in get_queryset
  442.         return super().get_queryset(request)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/admin/mixins.py" in get_queryset
  390.         return super().get_queryset(*args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/options.py" in get_queryset
  379.         qs = self.model._default_manager.get_queryset()
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/operations/models.py" in get_queryset
  142.         return queryset.filter(type__in=self.type_ids)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/utils/functional.py" in __get__
  59.         res = instance.__dict__[self.name] = self.func(instance)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/operations/models.py" in type_ids
  137.         root = OperationType.objects.get(pk=self._descendants_of)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/manager.py" in manager_method
  127.                 return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/query.py" in get
  334.                 self.model._meta.object_name

Exception Type: DoesNotExist at /operations/change/
Exception Value: OperationType matching query does not exist.

Environment:


Request Method: POST
Request URL: http://foo.bar/networks/ipaddress/export/

Django Version: 1.8.19
Python Version: 3.6.7
Installed Applications:
('ralph.admin',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.humanize',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django_rq',
 'import_export',
 'mptt',
 'reversion',
 'sitetree',
 'ralph.accounts',
 'ralph.assets',
 'ralph.attachments',
 'ralph.back_office',
 'ralph.configuration_management',
 'ralph.dashboards',
 'ralph.data_center',
 'ralph.dhcp',
 'ralph.deployment',
 'ralph.licences',
 'ralph.domains',
 'ralph.trade_marks',
 'ralph.sim_cards',
 'ralph.supports',
 'ralph.security',
 'ralph.lib.foundation',
 'ralph.lib.table',
 'ralph.networks',
 'ralph.data_importer',
 'ralph.dc_view',
 'ralph.reports',
 'ralph.virtual',
 'ralph.operations',
 'ralph.lib.external_services',
 'ralph.lib.transitions',
 'ralph.lib.permissions',
 'ralph.lib.custom_fields',
 'ralph.lib.hooks',
 'ralph.notifications',
 'ralph.ssl_certificates',
 'rest_framework',
 'rest_framework.authtoken',
 'taggit',
 'taggit_serializer')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'threadlocals.middleware.ThreadLocalMiddleware')


Traceback:
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.6/contextlib.py" in inner
  52.                 return func(*args, **kwds)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
  110.                     response = view_func(request, *args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/contrib/admin/sites.py" in inner
  233.             return view(request, *args, **kwargs)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/import_export/admin.py" in export_action
  346.             queryset = self.get_export_queryset(request)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/ralph/admin/mixins.py" in get_export_queryset
  422.         return list(queryset)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/query.py" in __iter__
  162.         self._fetch_all()
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/query.py" in _fetch_all
  965.             self._result_cache = list(self.iterator())
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/query.py" in iterator
  238.         results = compiler.execute_sql()
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in execute_sql
  829.             sql, params = self.as_sql()
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in as_sql
  378.             extra_select, order_by, group_by = self.pre_sql_setup()
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in pre_sql_setup
  48.         self.setup_query()
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in setup_query
  39.         self.select, self.klass_info, self.annotation_col_map = self.get_select()
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in get_select
  206.             related_klass_infos = self.get_related_selections(select)
File "/opt/ralph/ralph-core/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in get_related_selections
  754.                         ', '.join(_get_field_choices()) or '(none)',

Exception Type: FieldError at /networks/ipaddress/export/
Exception Value: Invalid field name(s) given in select_related: 'base_object'. Choices are: ethernet, network

Thanks for reporting it @Talangor 

@MarekBleschke looks like easy bug in "operations/changes" templates - I think @romcheg commited to operations last time
thanks, @vi4m for replying but how can I fix this? and I don't think its only in operations/changes!
I have posted 3 different tracebacks from different menus.
@Talangor Is something specific about the imported data on 7-th page? Some weird labels / empty text or non-standard fields?
@vi4m I have checked it and could not detect anything,
can you give me your e-mail address so I can send you the file I'm importing? , I will appreciate if you could check it out
I even reinstalled another ubuntu and checked if it will be working but no luck



I have tried to delete one field at a time and import it.
it had to do something with parent field in virtual servers I was importing because when I removed every parent it did not return 500 error.
I would like to have some specific error so I could trace it down but I appreciate your hard work.
me again

can you guys analyze this? its general log from when i get 500 error

"2019-05-18 09:30:10.544822","[ralph_ng] @ localhost [127.0.0.1]",140,0,"Connect","ralph_ng@localhost on ralph_ng using TCP/IP"
"2019-05-18 09:30:10.545411","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SET default_storage_engine=INNODB;"
"2019-05-18 09:30:10.545760","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SET character_set_connection=utf8,collation_connection=utf8_unicode_ci;"
"2019-05-18 09:30:10.546069","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED"
"2019-05-18 09:30:10.546497","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SET NAMES utf8"
"2019-05-18 09:30:10.546774","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SET SESSION sql_mode='TRADITIONAL'"
"2019-05-18 09:30:10.547209","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","set autocommit=0"
"2019-05-18 09:30:10.547513","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","set autocommit=1"
"2019-05-18 09:30:10.547937","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SET SQL_AUTO_IS_NULL = 0"
"2019-05-18 09:30:10.548504","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `django_session`.`session_key`, `django_session`.`session_data`, `django_session`.`expire_date` FROM `django_session` WHERE (`django_session`.`session_key` = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx' AND `django_session`.`expire_date` > '2019-05-18 07:00:10.542830')"
"2019-05-18 09:30:10.552147","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","set autocommit=0"
"2019-05-18 09:30:10.554081","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `accounts_ralphuser`.`id`, `accounts_ralphuser`.`password`, `accounts_ralphuser`.`last_login`, `accounts_ralphuser`.`is_superuser`, `accounts_ralphuser`.`username`, `accounts_ralphuser`.`first_name`, `accounts_ralphuser`.`last_name`, `accounts_ralphuser`.`email`, `accounts_ralphuser`.`is_staff`, `accounts_ralphuser`.`is_active`, `accounts_ralphuser`.`date_joined`, `accounts_ralphuser`.`country`, `accounts_ralphuser`.`city`, `accounts_ralphuser`.`company`, `accounts_ralphuser`.`employee_id`, `accounts_ralphuser`.`profit_center`, `accounts_ralphuser`.`cost_center`, `accounts_ralphuser`.`department`, `accounts_ralphuser`.`manager`, `accounts_ralphuser`.`location`, `accounts_ralphuser`.`segment`, `accounts_ralphuser`.`team_id` FROM `accounts_ralphuser` WHERE `accounts_ralphuser`.`id` = 1"
"2019-05-18 09:30:10.557619","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `transitions_transition`.`id`, `transitions_transition`.`name`, `transitions_transition`.`model_id`, `transitions_transition`.`run_asynchronously`, `transitions_transition`.`async_service_name`, `transitions_transition`.`source`, `transitions_transition`.`target`, `transitions_transition`.`template_name`, `transitions_transition`.`success_url` FROM `transitions_transition` INNER JOIN `transitions_transitionmodel` ON ( `transitions_transition`.`model_id` = `transitions_transitionmodel`.`id` ) WHERE `transitions_transitionmodel`.`content_type_id` = 15"
"2019-05-18 09:30:10.561319","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `transitions_transition`.`id`, `transitions_transition`.`name`, `transitions_transition`.`model_id`, `transitions_transition`.`run_asynchronously`, `transitions_transition`.`async_service_name`, `transitions_transition`.`source`, `transitions_transition`.`target`, `transitions_transition`.`template_name`, `transitions_transition`.`success_url` FROM `transitions_transition` INNER JOIN `transitions_transitionmodel` ON ( `transitions_transition`.`model_id` = `transitions_transitionmodel`.`id` ) WHERE `transitions_transitionmodel`.`content_type_id` = 15"
"2019-05-18 09:30:10.568222","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT COUNT(*) FROM (SELECT DISTINCT `assets_baseobject`.`id` AS Col1, `assets_baseobject`.`created` AS Col2, `assets_baseobject`.`modified` AS Col3, `assets_baseobject`.`content_type_id` AS Col4, `assets_baseobject`.`parent_id` AS Col5, `assets_baseobject`.`remarks` AS Col6, `assets_baseobject`.`service_env_id` AS Col7, `assets_baseobject`.`configuration_path_id` AS Col8, `virtual_virtualserver`.`baseobject_ptr_id` AS Col9, `virtual_virtualserver`.`status` AS Col10, `virtual_virtualserver`.`type_id` AS Col11, `virtual_virtualserver`.`hostname` AS Col12, `virtual_virtualserver`.`sn` AS Col13, `virtual_virtualserver`.`cluster_id` AS Col14 FROM `virtual_virtualserver` INNER JOIN `assets_baseobject` ON ( `virtual_virtualserver`.`baseobject_ptr_id` = `assets_baseobject`.`id` )) subquery"
"2019-05-18 09:30:10.597050","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `transitions_transition`.`id`, `transitions_transition`.`name`, `transitions_transition`.`model_id`, `transitions_transition`.`run_asynchronously`, `transitions_transition`.`async_service_name`, `transitions_transition`.`source`, `transitions_transition`.`target`, `transitions_transition`.`template_name`, `transitions_transition`.`success_url` FROM `transitions_transition` INNER JOIN `transitions_transitionmodel` ON ( `transitions_transition`.`model_id` = `transitions_transitionmodel`.`id` ) WHERE `transitions_transitionmodel`.`content_type_id` = 15"
"2019-05-18 09:30:10.604695","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT DISTINCT `assets_baseobject`.`id`, `assets_baseobject`.`created`, `assets_baseobject`.`modified`, `assets_baseobject`.`content_type_id`, `assets_baseobject`.`parent_id`, `assets_baseobject`.`remarks`, `assets_baseobject`.`service_env_id`, `assets_baseobject`.`configuration_path_id`, `virtual_virtualserver`.`baseobject_ptr_id`, `virtual_virtualserver`.`status`, `virtual_virtualserver`.`type_id`, `virtual_virtualserver`.`hostname`, `virtual_virtualserver`.`sn`, `virtual_virtualserver`.`cluster_id`, T4.`id`, T4.`created`, T4.`modified`, T4.`content_type_id`, T4.`parent_id`, T4.`remarks`, T4.`service_env_id`, T4.`configuration_path_id`, `assets_serviceenvironment`.`baseobject_ptr_id`, `assets_serviceenvironment`.`service_id`, `assets_serviceenvironment`.`environment_id`, `assets_service`.`id`, `assets_service`.`name`, `assets_service`.`created`, `assets_service`.`modified`, `assets_service`.`active`, `assets_service`.`uid`, `assets_service`.`profit_center_id`, `assets_service`.`business_segment_id`, `assets_service`.`cost_center`, `assets_service`.`support_team_id`, `assets_environment`.`id`, `assets_environment`.`name`, `assets_environment`.`created`, `assets_environment`.`modified`, T8.`id`, T8.`created`, T8.`modified`, T8.`content_type_id`, T8.`parent_id`, T8.`remarks`, T8.`service_env_id`, T8.`configuration_path_id`, `assets_configurationclass`.`baseobject_ptr_id`, `assets_configurationclass`.`class_name`, `assets_configurationclass`.`path`, `assets_configurationclass`.`module_id`, `assets_configurationmodule`.`id`, `assets_configurationmodule`.`created`, `assets_configurationmodule`.`modified`, `assets_configurationmodule`.`name`, `assets_configurationmodule`.`parent_id`, `assets_configurationmodule`.`support_team_id`, `assets_configurationmodule`.`lft`, `assets_configurationmodule`.`rght`, `assets_configurationmodule`.`tree_id`, `assets_configurationmodule`.`level`, `virtual_virtualservertype`.`id`, `virtual_virtualservertype`.`name`, `virtual_virtualservertype`.`created`, `virtual_virtualservertype`.`modified`, `configuration_management_scmstatuscheck`.`id`, `configuration_management_scmstatuscheck`.`created`, `configuration_management_scmstatuscheck`.`modified`, `configuration_management_scmstatuscheck`.`base_object_id`, `configuration_management_scmstatuscheck`.`last_checked`, `configuration_management_scmstatuscheck`.`check_result`, `configuration_management_scmstatuscheck`.`ok`, `security_securityscan`.`id`, `security_securityscan`.`created`, `security_securityscan`.`modified`, `security_securityscan`.`last_scan_date`, `security_securityscan`.`scan_status`, `security_securityscan`.`next_scan_date`, `security_securityscan`.`details_url`, `security_securityscan`.`rescan_url`, `security_securityscan`.`base_object_id`, `security_securityscan`.`is_patched` FROM `virtual_virtualserver` INNER JOIN `assets_baseobject` ON ( `virtual_virtualserver`.`baseobject_ptr_id` = `assets_baseobject`.`id` ) LEFT OUTER JOIN `assets_serviceenvironment` ON ( `assets_baseobject`.`service_env_id` = `assets_serviceenvironment`.`baseobject_ptr_id` ) LEFT OUTER JOIN `assets_baseobject` T4 ON ( `assets_serviceenvironment`.`baseobject_ptr_id` = T4.`id` ) LEFT OUTER JOIN `assets_service` ON ( `assets_serviceenvironment`.`service_id` = `assets_service`.`id` ) LEFT OUTER JOIN `assets_environment` ON ( `assets_serviceenvironment`.`environment_id` = `assets_environment`.`id` ) LEFT OUTER JOIN `assets_configurationclass` ON ( `assets_baseobject`.`configuration_path_id` = `assets_configurationclass`.`baseobject_ptr_id` ) LEFT OUTER JOIN `assets_baseobject` T8 ON ( `assets_configurationclass`.`baseobject_ptr_id` = T8.`id` ) LEFT OUTER JOIN `assets_configurationmodule` ON ( `assets_configurationclass`.`module_id` = `assets_configurationmodule`.`id` ) INNER JOIN `virtual_virtualservertype` ON ( `virtual_virtualserver`.`type_id` = `virtual_virtualservertype`.`id` ) LEFT OUTER JOIN `configuration_management_scmstatuscheck` ON ( `assets_baseobject`.`id` = `configuration_management_scmstatuscheck`.`base_object_id` ) LEFT OUTER JOIN `security_securityscan` ON ( `assets_baseobject`.`id` = `security_securityscan`.`base_object_id` ) ORDER BY `virtual_virtualserver`.`baseobject_ptr_id` DESC LIMIT 100 OFFSET 600"
"2019-05-18 09:30:10.748615","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `assets_baseobject`.`id`, `assets_baseobject`.`created`, `assets_baseobject`.`modified`, `assets_baseobject`.`content_type_id`, `assets_baseobject`.`parent_id`, `assets_baseobject`.`remarks`, `assets_baseobject`.`service_env_id`, `assets_baseobject`.`configuration_path_id` FROM `assets_baseobject` WHERE `assets_baseobject`.`id` IN (416, 418, 3, 419, 38, 39, 40, 42, 43, 44, 45, 47, 22, 24, 25, 26, 60, 61, 62)"
"2019-05-18 09:30:10.751682","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `django_content_type`.`id`, `django_content_type`.`app_label`, `django_content_type`.`model` FROM `django_content_type` WHERE `django_content_type`.`id` IN (8, 9, 15)"
"2019-05-18 09:30:10.755188","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `assets_baseobject`.`id`, `assets_baseobject`.`created`, `assets_baseobject`.`modified`, `assets_baseobject`.`content_type_id`, `assets_baseobject`.`parent_id`, `assets_baseobject`.`remarks`, `assets_baseobject`.`service_env_id`, `assets_baseobject`.`configuration_path_id`, `assets_asset`.`baseobject_ptr_id`, `assets_asset`.`model_id`, `assets_asset`.`hostname`, `assets_asset`.`sn`, `assets_asset`.`barcode`, `assets_asset`.`niw`, `assets_asset`.`required_support`, `assets_asset`.`order_no`, `assets_asset`.`invoice_no`, `assets_asset`.`invoice_date`, `assets_asset`.`price`, `assets_asset`.`provider`, `assets_asset`.`depreciation_rate`, `assets_asset`.`force_depreciation`, `assets_asset`.`depreciation_end_date`, `assets_asset`.`buyout_date`, `assets_asset`.`task_url`, `assets_asset`.`budget_info_id`, `assets_asset`.`property_of_id`, `assets_asset`.`start_usage`, `data_center_datacenterasset`.`asset_ptr_id`, `data_center_datacenterasset`.`rack_id`, `data_center_datacenterasset`.`status`, `data_center_datacenterasset`.`position`, `data_center_datacenterasset`.`orientation`, `data_center_datacenterasset`.`slot_no`, `data_center_datacenterasset`.`firmware_version`, `data_center_datacenterasset`.`bios_version`, `data_center_datacenterasset`.`source`, `data_center_datacenterasset`.`delivery_date`, `data_center_datacenterasset`.`production_year`, `data_center_datacenterasset`.`production_use_date` FROM `data_center_datacenterasset` INNER JOIN `assets_asset` ON ( `data_center_datacenterasset`.`asset_ptr_id` = `assets_asset`.`baseobject_ptr_id` ) INNER JOIN `assets_baseobject` ON ( `assets_asset`.`baseobject_ptr_id` = `assets_baseobject`.`id` ) WHERE `data_center_datacenterasset`.`asset_ptr_id` IN (22, 24, 25, 26, 38, 39, 40, 42, 43, 44, 45, 47, 60, 61, 62)"
"2019-05-18 09:30:10.761393","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `assets_baseobject`.`id`, `assets_baseobject`.`created`, `assets_baseobject`.`modified`, `assets_baseobject`.`content_type_id`, `assets_baseobject`.`parent_id`, `assets_baseobject`.`remarks`, `assets_baseobject`.`service_env_id`, `assets_baseobject`.`configuration_path_id`, `licences_licence`.`baseobject_ptr_id`, `licences_licence`.`region_id`, `licences_licence`.`manufacturer_id`, `licences_licence`.`licence_type_id`, `licences_licence`.`property_of_id`, `licences_licence`.`software_id`, `licences_licence`.`number_bought`, `licences_licence`.`sn`, `licences_licence`.`niw`, `licences_licence`.`invoice_date`, `licences_licence`.`valid_thru`, `licences_licence`.`order_no`, `licences_licence`.`price`, `licences_licence`.`depreciation_rate`, `licences_licence`.`accounting_id`, `licences_licence`.`provider`, `licences_licence`.`invoice_no`, `licences_licence`.`license_details`, `licences_licence`.`office_infrastructure_id`, `licences_licence`.`budget_info_id`, `licences_licence`.`start_usage` FROM `licences_licence` INNER JOIN `assets_baseobject` ON ( `licences_licence`.`baseobject_ptr_id` = `assets_baseobject`.`id` ) WHERE `licences_licence`.`baseobject_ptr_id` IN (3)"
"2019-05-18 09:30:10.764319","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `assets_baseobject`.`id`, `assets_baseobject`.`created`, `assets_baseobject`.`modified`, `assets_baseobject`.`content_type_id`, `assets_baseobject`.`parent_id`, `assets_baseobject`.`remarks`, `assets_baseobject`.`service_env_id`, `assets_baseobject`.`configuration_path_id`, `virtual_virtualserver`.`baseobject_ptr_id`, `virtual_virtualserver`.`status`, `virtual_virtualserver`.`type_id`, `virtual_virtualserver`.`hostname`, `virtual_virtualserver`.`sn`, `virtual_virtualserver`.`cluster_id` FROM `virtual_virtualserver` INNER JOIN `assets_baseobject` ON ( `virtual_virtualserver`.`baseobject_ptr_id` = `assets_baseobject`.`id` ) WHERE `virtual_virtualserver`.`baseobject_ptr_id` IN (416, 418, 419)"
"2019-05-18 09:30:10.767052","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","commit"
"2019-05-18 09:30:10.767429","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","set autocommit=1"
"2019-05-18 09:30:10.774005","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `django_content_type`.`app_label`, `auth_permission`.`codename` FROM `auth_permission` INNER JOIN `django_content_type` ON ( `auth_permission`.`content_type_id` = `django_content_type`.`id` )"
"2019-05-18 09:30:10.783109","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Query","SELECT `django_content_type`.`app_label`, `auth_permission`.`codename` FROM `auth_permission` INNER JOIN `django_content_type` ON ( `auth_permission`.`content_type_id` = `django_content_type`.`id` )"
"2019-05-18 09:30:10.934429","ralph_ng[ralph_ng] @ localhost [127.0.0.1]",140,0,"Quit",""
sorry to bother but I should report.
I found the problem ! it was an datacenter hardware and could not recognize why because everything was right

i have 2 more problems 
1 is when i try to export ip addresses 
with this log 
django.core.exceptions.FieldError: Invalid field name(s) given in select_related: 'base_object'. Choices are: Ethernet, network
**_by the way in your own Ralph demo it returns 500 error when exporting ip address_**
2 in operation change

2 days and no reply?
it can't be fixed? 


is when i try to export ip addresses
with this log
django.core.exceptions.FieldError: Invalid field name(s) given in select_related: 'base_object'. Choices are: Ethernet, network
by the way in your own Ralph demo it returns 500 error when exporting ip address
Hi @Talangor , please email us the file you are trying to import to pylabs@allegro.pl. 

I checked the first error you reported (at /virtual/virtualserver) and I am unable to replicate it.
HI @szymi-  i have found and solved the problem that i had with virtual machines it had to do something with one of the hardwares in the datacenter (virtual server parent) just deleted the machine and recreated it and everything is fine now

i have other problem now, when i try to export ip address in network section i get 500 error.
i have checked your official demo site and it has the same problem.

OK, I'll investigate the error with IP export.

Resolving patch:
diff --git a/src/ralph/admin/mixins.py b/src/ralph/admin/mixins.py
--- a/src/ralph/admin/mixins.py
+++ b/src/ralph/admin/mixins.py
@@ -402,7 +402,8 @@ def get_export_queryset(self, request):
         for name, field in resource.fields.items():
             if (
                 isinstance(field.widget, ForeignKeyWidget) and
-                not getattr(field, '_exclude_in_select_related', False)
+                not getattr(field, '_exclude_in_select_related', False) and
+                not isinstance(getattr(queryset.model, name, None), property)
             ):
                 fk_fields.append(field.attribute)
         if fk_fields:


Test patch: