This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from copy import copy | |
| def get_count(new_art, a): | |
| return sum([el.count(a) for el in new_art]) | |
| def format_output(tiles): | |
| nr = [] | |
| for r in tiles: | |
| nr.append("".join(r)) | |
| tr_str = "\n".join(nr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class YourAdmin(ModelAdmin): | |
| def changelist_view(self, request, extra_context=None): | |
| ref = request.META.get('HTTP_REFERER','') | |
| path = request.META.get('PATH_INFO','') | |
| if not ref.split(path)[-1].startswith('?'): | |
| q = request.GET.copy() | |
| q['usertype'] = 'Publisher' | |
| q['user_status__exact'] = 'activated' | |
| request.GET = q | |
| request.META['QUERY_STRING'] = request.GET.urlencode() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| virtualenv --no-site-packages . | |
| source bin/activate | |
| bin/pip install Django psycopg2 django-sentry | |
| bin/pip freeze > requirements.txt | |
| bin/django-admin.py startproject mysite | |
| cat >.gitignore <<EOF | |
| bin/ | |
| include/ | |
| lib/ | |
| EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_form(self, request, obj=None): | |
| form = super(WapSiteAdmin,self).get_form(request, obj) | |
| pl = Platform.objects.get(id=obj.platform_type_id) | |
| rev_alert=WapSite.objects.filter(pub=obj.pub,pub_share__gt= str(obj.pub_share)).count() | |
| if rev_alert !=0: | |
| rev_msg='<b style ="color:red;">Please check the rev share ,publisher has got sites running on rev share greater then this</b>' | |
| else: | |
| rev_msg='<b>Please select the rev_share</b>' | |
| messege = 'Click here to get filter info' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib.sessions.backends.base import SessionBase, CreateError | |
| from django.conf import settings | |
| from django.utils.encoding import force_unicode | |
| import redis | |
| class SessionStore(SessionBase): | |
| """ Redis store for sessions""" | |
| def __init__(self, session_key=None): | |
| self.redis = redis.Redis( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest2 as unittest | |
| def get_verify_mtd(sum_tuple, sum_value): | |
| def test1(self): | |
| self.assertEqual(sum(sum_tuple),sum_value) | |
| return test1 | |
| def create_test_case_class(): | |
| sumlist = range(20,30,2) | |
| sum1_list = [20]*5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_method_from_file(full_path=['credit', 'syndloan', 'importer', 'sql', 'sql', 'loanDealSql']): | |
| if len(full_path) == 1: | |
| return map(__import__,[full_path[0]])[0] | |
| return getattr(get_method_from_file(full_path[:-1]),full_path[-1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA0yVPIfiCJWVipZAriF4nWSEvNaWxMK1Ruz7sqz86eT/vp9hvZRWPVNoT4N56JTyZbfYoSGfIhf0N1AUkDzsMTcXezL8WJ67c8Yr+29mFZ36iA7eVHNbeyCH3UGgNRV+Sqhu0i+Q8DKt4F77BMXBxGikE2Z8nLU2lPqZcYrUvjTbx5RuWH1o7/GFt9Tof7jNjsMRwy5FoKaZ+BK6vwm0hTGPuC2bHeQCNABUxmPhZGkGYngSbDxOP3+xdCRTpmmOEChZN3r0UXFC3re1tKoenNldxYPSw5l7z4SlhjY0UTVUFx6txZh/k3O2DQe19Ei3ZxiU6LeLhbbd0L4RK6KU/Pw== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 302 745 2095 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foo |