def abandon_tribe(request):
  info = []
  tribe_id = request.GET.get('tribe_id', False)
  tribe = get_object_by_id(tribe_id, 'Tribe', request.user)
  confirmed = request.GET.get('confirmed', False)

  if confirmed == 'true':
    show_confirm = 'false'
    tribe.user = None
    try:
      tribe.save()
      write_log('info', "User abandoned tribe {}".format(tribe.id), request)
      messages.info(request, _('info_abandon_tribe_success') % {'tribe_name': tribe.name})
      return HttpResponseRedirect('/' + request.LANGUAGE_CODE + '/overview')
    except:  # pragma: no cover
      pass
  else:
    show_confirm = 'true'

  return render(request, 'stoneball/abandon_tribe.html', {'info': info,
                                                          'show_confirm': show_confirm,
                                                          'tribe': tribe,
                                                          'current_page': 'overview'})
def tribe_detail(request):
  tribe = get_object_by_id(int(request.GET.get('tribe_id', '')), 'Tribe', request.user)
  return render(request, 'stoneball/tribe_detail.html', {'tribe': tribe, 'current_page': 'overview'})