Twitter Bootstrap: How to change the tooltip text label

Oh my God, twitter bootstrap is a pretty damn good styling and widget framework. Check it out!

My first issue with it however is that I couldn't find a way to change the tooltip label after it's been created.

It's easily solved, but with a rather convoluted and hidden method.

$('#target').attr('data-original-title', item.value + ' selected.').tooltip('fixTitle');

What this one line wonder does is change the title attribute, then tell it to update using the "fixTitle" call.

Flying-kick-headshot 
BOOM! HEADSHOT!

Source

Django: How to save InMemoryUploadedFile (a temporary uploaded file) to disk?

When a user uploads a file using forms.FileField, you usually want to save it in some way.

To stash the file away on disk, just use the following snippet.

from django.core.files.storage import default_storage
from django.core.files.base import ContentFile

file = request.FILES['your_file_fieldname']
path = default_storage.save('heart_of_the_swarm.txt', ContentFile(file.read()))

There you have it!

i4IaIek6mz5sW

Now back to more important things, like eating cheerleaders.

Source

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog