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
INSTALLED_APPS += ('raven.contrib.django.raven_compat',) | |
RAVEN_CONFIG = { | |
'dsn': 'DSN_URL', | |
} | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': True, | |
'root': { |
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 connection | |
def print_queries_quantity(func): | |
def wrapper(self, *args, **kwargs): | |
old = len(connection.queries) | |
ret = func(self, *args, **kwargs) | |
quantity = len(connection.queries) - old | |
print '%d queries in %s' % (quantity, func.__name__) |
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 pyjasperclient import JasperClient | |
class BaseJasperReport(object): | |
report_path = '/reports/report_name' | |
jasper_url = 'http://localhost:8080/jasperserver/services/repository?wsdl' | |
jasper_user = 'jasperadmin' | |
jasper_password = 'jasperadmin' | |
def __init__(self): |
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
'use strict'; | |
var app = angular.module('myApp', []); | |
app.config(['$interpolateProvider', function ($interpolateProvider) { | |
$interpolateProvider.startSymbol('[[').endSymbol(']]'); | |
}]); |
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
response = HttpResponse(content_type='application/pdf') | |
response['Content-Disposition'] = 'attachment; filename="{}.pdf"'.format('file name') | |
response.write('contenido del pdf') # lo generas con alguna libreria como reportlab | |
return response |
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 SaleOrder(models.Model): | |
_inherit = 'sale.order' | |
@api.model | |
def create(self, values): | |
record = super(SaleOrder, self).create(values) | |
import urllib2 | |
import json | |
req = urllib2.Request('http://localhost:3000/send-message/', data=json.dumps({ |
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 SaleOrder(models.Model): | |
_inherit = 'sale.order' | |
@api.model | |
def create(self, values): | |
record = super(SaleOrder, self).create(values) | |
import urllib2 | |
import json | |
data = { |
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
@api.v7 | |
def select_objects(self, cr, uid, ids, context=None): | |
record = self.browse(cr, uid, ids[0], context=context) | |
return { | |
'type': 'ir.actions.act_window', | |
'res_model': 'hacom.select.object.for.installation', | |
'name': 'wizard', | |
'view_mode': 'form', | |
'view_type': 'form', | |
'target': 'new', |
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
@api.v7 | |
def select_objects(self, cr, uid, ids, context=None): | |
return { | |
'type': 'ir.actions.act_window', | |
'res_model': 'model', | |
'name': 'wizard', | |
'view_mode': 'form', | |
'view_type': 'form', | |
'target': 'new' |
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 num2words import num2words | |
num2words(235, lang='es') | |
# result: u'doscientos treinta y cinco' |
OlderNewer