Skip to content

Instantly share code, notes, and snippets.

View gist:162633
root@shabda:~# sudo pip install -e svn+http://code.djangoproject.com/svn/django/trunk/#egg=django_trunk
Installed /root/src/django-trunk
Successfully installed django-trunk
>>> import django
>>> django.get_version()
u'1.2 pre-alpha SVN-11400'
View gist:165296
def get_active_for_account(self,account,*args,**kwargs):
"""Returns a queryset that is
Not deleted
Not completed
For the specified account
"""
return self.filter(account = account,deleted=False,group_time__gte = datetime.now(), *args, **kwargs)
View gist:214956
######################################################################
# modified by lakshman
# jdong's zshrc file v0.2.1 , based on:
# mako's zshrc file, v0.1
#
#
######################################################################
# next lets set some enviromental/shell pref stuff up
# setopt NOHUP
@becomingGuru
becomingGuru / .pythonrc.py
Created Nov 11, 2009
bpython equivallent of shell_plus
View .pythonrc.py
try:
from django.core.management import setup_environ
import settings
setup_environ(settings)
print 'imported django settings'
try:
exec_strs = ["from %s.models import *"%apps for apps in settings.INSTALLED_APPS ]
for x in exec_strs:
try:
exec(x)
We couldn’t find that file to show.
View flickr_photo_detail_finder.py
ids = ['4153869960',
'4160152863',
'4165131655',
'4164906099',
'4165892330',
'4165146115']
import urllib
import json
View test.py
class A():
def __new__(cls,i):
class C(cls,B):
pass
print C
self = C()
print self
return self
View render2.py
from django.shortcuts import render_to_response
from django.template.context import RequestContext
def eb_render(request, *args, **kwargs):
"""
Replacement for render_to_response that uses RequestContext and sets an
extra template variable, TEMPLATE_NAME.
"""
kwargs['context_instance'] = RequestContext(request)
return render_to_response(*args, **kwargs)
View render.py
def render(request, template_name, args=None, kwargs=None):
context = dict([ (var, locals()[var]) for var in args ]) if args else {}
context.update(kwargs) if kwargs else pass
return render_to_response(template_name,context,RequestContext(request))
View gist:276166
<QueryDict: {u'genericcontentblock_set-10-content': [u''], u'genericcontentblock_set-11-title': [u''], u'page_title': [u''], u'genericcontentblock_set-0-title': [u'adasdasd'], u'genericcontentblock_set-11-content': [u''], u'genericcontentblock_set-3-content': [u''], u'genericcontentblock_set-1-data': [u'dsadasdasd'], u'genericcontentblock_set-4-data': [u'Madhapur, Hyderabad'], u'genericcontentblock_set-8-id': [u'307'], u'genericcontentblock_set-1-id': [u'300'], u'genericcontentblock_set-5-data': [u'hyderabad'], u'genericcontentblock_set-4-revision': [u'286'], u'genericcontentblock_set-0-content': [u''], u'genericcontentblock_set-1-content': [u''], u'genericcontentblock_set-5-title': [u''], u'genericcontentblock_set-6-id': [u'305'], u'genericcontentblock_set-4-content': [u''], u'genericcontentblock_set-2-id': [u'301'], u'genericcontentblock_set-11-id': [u''], u'genericcontentblock_set-9-content': [u''], u'genericcontentblock_set-7-title': [u''], u'genericcontentblock_set-INITIAL_FORMS': [u'9'], u'genericconten
You can’t perform that action at this time.