This file contains 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 convert(self, filename, sheet_name='Sheet1'): | |
wb = load_workbook(filename=filename, data_only=True) | |
sheet = wb[sheet_name] | |
row_num = 1 | |
for row in sheet.rows: | |
if row_num != 1: | |
try: | |
status = row[self.columns['original_name']].value | |
This file contains 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
<nav aria-label="Page navigation example"> | |
<ul class="pagination"> | |
{% if page_obj.has_previous %} | |
<li class="page-item"> | |
<a href="?page={{ page_obj.previous_page_number }}&order_by={{ order_by }}&direction={{ direction }}" | |
class="page-link"> | |
<span aria-hidden="true">«</span> | |
<span class="sr-only">Previous</span> |
This file contains 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 $MODEL$ListView(LoginRequiredMixin, ListView): | |
model = $MODEL$ | |
context_object_name = '$context_object$_list' | |
def get_queryset(self): | |
return $MODEL$.objects.all() | |
class $MODEL$UpdateView(LoginRequiredMixin, UpdateView): | |
model = $MODEL$ | |
context_object_name = '$context_object$' |
This file contains 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 $MODEL$Form(ModelForm): | |
class Meta: | |
model = $MODEL$ | |
fields = ['', ] |
This file contains 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
{% extends "base.html" %} | |
{% load staticfiles bootstrap3 i18n %} | |
{% block extra_css %} | |
{{ form.media }} | |
{% endblock extra_css %} | |
{% block page_title %} | |
$PAGE_TITLE | |
{% endblock page_title %} | |
{% block content %} |
This file contains 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
@echo off | |
SET VIRTUAL_ENVIRONMENT_FOLDER=C:\python_environments | |
SET PYCHARM_PROJECT_FOLDER=%USERPROFILE%\PyCharmProjects | |
SET PYTHON_PROJECT=%~1 | |
SET PROJECT_ENVIRONMENT=%VIRTUAL_ENVIRONMENT_FOLDER%\%PYTHON_PROJECT%_env | |
cd %VIRTUAL_ENVIRONMENT_FOLDER% | |
REM echo %PYCHARM_PROJECT_FOLDER% | |
echo %PROJECT_ENVIRONMENT% | |
C:\Python34\python.exe C:\Python34\Lib\site-packages\virtualenv.py --no-site-packages %PROJECT_ENVIRONMENT% |
This file contains 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
#!/bin/bash -e | |
VIRTUAL_ENVIRONMENT_FOLDER=~/virtual_environments | |
PYCHARM_PROJECT_FOLDER=~/PycharmProjects/ | |
cd $VIRTUAL_ENVIRONMENT_FOLDER; | |
/usr/local/Cellar/python3/3.4.1_1/bin/python3 /usr/local/lib/python3.4/site-packages/virtualenv.py --no-site-packages $1_env; | |
source $VIRTUAL_ENVIRONMENT_FOLDER/$1_env/bin/activate |
This file contains 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
########## LOGGING CONFIGURATION | |
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging | |
# A sample logging configuration. The only tangible logging | |
# performed by this configuration is to send an email to | |
# the site admins on every HTTP 500 error when DEBUG=False. | |
# See http://docs.djangoproject.com/en/dev/topics/logging for | |
# more details on how to customize your logging configuration. | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, |
This file contains 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<templates> | |
<template autoinsert="true" context="org.python.pydev.editor.templates.python" deleted="false" description="csv reader" enabled="true" name="vib_csv_reader">csv_filename= r'' | |
csvreader = csv.reader(open(csv_filename, 'rb'), delimiter=',', quotechar='|') | |
rc = 1 | |
for row in csvreader: | |
if rc != 1: | |
regexp = re.compile('[\s\(\)\[\]/{}.,]+') | |
clean_value = regexp.sub('', row[6]).strip() | |
rc += 1</template> |
This file contains 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 os, base64 | |
from Crypto.Cipher import AES | |
import hashlib | |
class Encryptor(object): | |
# the block size for the cipher object; must be 16, 24, or 32 for AES | |
block_size = 32 | |
padding = '{' | |
def __init__(self, secret): | |
self.secret = hashlib.sha256(secret).digest() |