Skip to content

Instantly share code, notes, and snippets.

View FernandoEscher's full-sized avatar
🏠
Working from home

Fernando Irias Escher FernandoEscher

🏠
Working from home
  • Tegucigalpa, Honduras
View GitHub Profile
@FernandoEscher
FernandoEscher / gist:792865
Created January 24, 2011 05:12
Atributos dinámicos en Python
class Dummy(object):
def __getattribute__(self, name):
f = lambda: 'hola con %s'%name
return f
def page_management(request, items, num_items):
"""
Gets the page data from the post of a request.
Returns a dict with the actual page information.
"""
page_change = request.POST.get('quiz_page_change', '')
paginator = Paginator([item for item in items], num_items)
if page_change == 'Previous':
page_to_render = request.POST.get('prev_page', '1')
@FernandoEscher
FernandoEscher / gist:650909
Created October 28, 2010 08:30
Notification HTML emails
def send_now(users, label, extra_context=None, on_site=True, context=None):
"""
Creates a new notice.
This is intended to be how other apps create new notices.
notification.send(user, 'friends_invite_sent', {
'spam': 'eggs',
'foo': 'bar',
)
#Add this file in your /home/<username>/ dir.
#You can add extra aliases if you want.
#Run this command on shell after adding a alias: $ . /home/<username>/.bash_aliases
alias git-log='git log --decorate --stat --graph --pretty=format:"%Cgreen%h%Creset (%ar - %Cred%an%Creset), %s%n"'