Rinse sardines and cut off heads and tails. Using a sharp knife, slice each fish open so that it lies flat, skin side down. Remove and discard bones using the tip of the knife or by running your index finger between backbone and flesh (see Fileting Sardines). Rinse sardines and pat dry.
Pour vegetable oil into a large skillet to a depth of 1⁄2" and heat over high heat. Dredge sardines in flour, and fry sardines until lightly golden, about 15 seconds per side. Drain on paper towels. Season to taste with salt.
Bring a medium pot of water to a boil. Add onions, blanch for 10 seconds, then drain. Heat olive oil in a large skillet over medium-low heat. Add onions and shallots and cook, stirring often, until very soft, 20–30 minutes. Add raisins, pine nuts, and 6 tbsp. of the vinegar, and season to taste with salt. Reduce heat to low and cook, stirring often, until vinegar has been absorbed, about 20 minutes. Set aside to cool.
Layer onions and sardines in a ceramic dish, beginning and ending with onions. Sprinkle remaining 6 tbsp. of vinegar between layers. Cover and set aside for 2–3 days in a cool place—not in refrigerator. Serve at room temperature, with room-temperature Grilled Polenta, if you like.