Two template filters for Django
I want to signal two new template filters for Django. Precise truncate words by chars It truncates the text when it exceeds a certain number of characters and deletes the last word. Adds ‘…’ at the end of the text, only if truncated. The difference between other similar filters is that this deletes the last [...]
Python client for the Nirvanix API
I released a Python client for Nirvanix. The project page is: https://www.hosted-projects.com/trac/Design/pub/wiki/Nirvanapi It include the most important API calls, is light (one file and less of 400 lines of code) and have not dependences. The client support right now the following API calls: LoginLogoutCreateFoldersDeleteFoldersDeleteFilesCopyFilesCopyFoldersMoveFilesMoveFoldersRenameFileRenameFolderSideuploadListFolderCreateHostedItemExtractFrames The login is automatic also when the connection drop. List a [...]
Backpack Update – Aggiornamento per Backpack
Since few hours Backpack has been updated and it is avaiable the new API that correct various problematic that plagued it. The Python client that I have wrote will be updated too and published soon. The new features will be: – multi list management; – all objects of the pages can now be ordered; – [...]
Backpack Client for Python
A Backpack client API for Python will be released soon. Ready features: – API interface and object interface; – creation and updating of Backpack objects with a single save method; – objects avaiables: pages, notes, items, tags but also lists! – page linking; – page sending via email; – support for SSL (not tested). Next [...]
Preview di un testo con una sola riga di Python
Nei siti web capita spesso di mostrare una preview di una news o di un articolo. Queste preview includono solo una parte del testo per poter elencare più articoli o news nella stessa pagina senza appesantire troppo la navigazione. A tal proposito ecco una funzione di una sola riga che prende un testo, lo accorcia [...]
Convertire l’HTML in HTML sicuro
Scrivendo su di un blog tecnico capita spesso di aver codice da mostrare. In particolare, quando il suddetto codice proprio HTML bisogna provvedere a convertire alcuni caratteri perché altrimenti il browser, riconoscendolo, lo valuta. In python sono sufficienti pochi comandi per effettuare la conversione: # legge il file “from.txt” contenente il testo da convertiretext = [...]
Create an image model for your photos in Django with multiple categories
I write this post because Django documentation is not exhaustive for the ImageField. Create an application in your project with: $ python manager.py startapp photos You can use what application name you like. Then create the directory “photos” in your media directory. Enter in the application directory and edit the models.py file: from django.db import [...]