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
# -*- coding: utf-8 -*- | |
from datetime import date, timedelta | |
def add_weekdays(initial_date, days): | |
final_date = initial_date | |
for i in xrange(1, days + 1): | |
final_date = final_date + timedelta(days=1) | |
while final_date.weekday() in [5, 6]: | |
final_date = final_date + timedelta(days=1) |
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
from distutils.core import setup | |
import py2exe | |
setup( | |
windows=[{ | |
'script': 'main.py', | |
'icon_resources': [(1, "icon.ico")], | |
}], | |
options={ | |
'py2exe': { |
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
select address from mailer_email into outfile '/home/gileno/emails3.txt'; |
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
alternatives = Alternative.objects.filter(exercise=exercise) | |
select_sql = u'''select courses_solveexercise.response | |
from courses_solveexercise where | |
courses_solveexercise.user_id=%s and | |
courses_solveexercise.alternative_id=courses_alternative.id''' | |
alternatives = alternatives.extra(select=SortedDict([('user_response', select_sql)]), | |
select_params=[user.id]) |
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
# E-mails | |
DEFAULT_FROM_EMAIL = 'Nome <[email protected]>' | |
EMAIL_USE_TLS = True | |
EMAIL_HOST = 'smtp.gmail.com' | |
EMAIL_HOST_USER = '[email protected]' | |
EMAIL_HOST_PASSWORD = 'senha' | |
EMAIL_PORT = 587 |
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
# -*- coding: utf-8 -*- | |
import os | |
import time | |
import settings | |
from fabric.contrib.console import confirm | |
from fabric.api import local, settings as fabric_settings, env, cd, run, sudo | |
env.hosts = ['domain_or_ip'] |
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
{% if is_paginated %} | |
<div class="pagination pagination-right"> | |
<ul> | |
{% if page_obj.has_previous %} | |
<li> | |
<a href="?page={{ page_obj.previous_page_number }}{{ getvars }}">‹‹ anterior</a> | |
</li> | |
{% endif %} | |
{% for page in pages %} | |
{% if page %} |
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
# -*- coding: utf-8 -*- | |
import posixpath | |
import urllib | |
import os | |
from django.conf import settings | |
from django.views.static import serve | |
from django.http import HttpResponse | |
from django.utils.encoding import smart_str |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
bind = '127.0.0.1:9999' | |
workers = 2 | |
logfile = '/tmp/gunicorn_project.log' |
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
from django.db import models | |
class Propriedade(models.Model): | |
pass | |
class PropriedadeRef(models.Model): | |