1. David Jean Louis
  2. django-admin-tools
  3. Issues
Issue #61 resolved

MultipleObjectsReturned: get() returned more than one DashboardPreferences -- it returned 2!

Anonymous created an issue

I don't know how does it possible, but it's happend sometime. To fix it for me I added data for user dashboard preferences when we catch DashboardPreferences.DoesNotExist in admin_tools_render_dashboard: {{{


preferences = '{}' prefs = DashboardPreferences() prefs.user = context['request'].user prefs.data = preferences prefs.save() }}}

it's create an empty record for user before any Ajax save will be posted and prevent situation when 2 parallel ajax request write 2 conflicted rows into database.

Comments (2)

  1. Log in to comment