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.utils import six | |
| from django.utils.encoding import force_str | |
| class ReadOnlyFieldsMixin(object): | |
| readonly_fields = () | |
| def __init__(self, *args, **kwargs): | |
| super(ReadOnlyFieldsMixin, self).__init__(*args, **kwargs) | |
| self.define_readonly_fields(self.fields) |
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 decimal import Decimal | |
| >>> Decimal('2.14999').quantize(Decimal('0.00')) | |
| Decimal('2.15') |
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
| {% extends 'agendamento/base_comitente.html' %} | |
| {% load bootstrap %} | |
| {% block extra_css %} | |
| <style> | |
| .form-actions{ | |
| padding:10px; | |
| background-color:#EEE; | |
| border-top:1px solid #CCC; | |
| } |
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
| select.form-control + .chosen-container.chosen-container-single .chosen-single { | |
| display: block; | |
| width: 100%; | |
| height: 34px; | |
| padding: 6px 12px; | |
| font-size: 14px; | |
| line-height: 1.428571429; | |
| color: #555; | |
| vertical-align: middle; | |
| background-color: #fff; |
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.db.models import Count | |
| from .models import DummyModel | |
| class ExampleClass(object): | |
| def get_queryset(self) | |
| filter = { | |
| 'foo': 'bar', | |
| 'baz': True |
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
| $ cat dados.csv | wc -l | |
| 26934 | |
| $ cat dados.csv | head | |
| user_id,marca,modelo,ano,estado_geral | |
| 14840,Honda,CG 150 Titan ES,2006/2007,Veículo irrecuperável sem motor | |
| 56762,Honda,CG 150 Titan ES,2006/2007,Veículo irrecuperável sem motor | |
| 14840,Honda,CG 150 Titan ES,2006/2007,Veículo irrecuperável sem motor | |
| 53398,Honda,CG 150 Titan ES,2006/2007,Veículo irrecuperável sem motor | |
| 56434,Honda,CG 150 Titan ES,2006/2007,Veículo irrecuperável sem motor |
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 unittest import TestCase | |
| from mock import patch, Mock | |
| from matriz import Matriz | |
| class MatrizTest(TestCase): | |
| @patch('matriz.Matriz.inicializar_matriz') | |
| def test_intancia_matriz(self, method): | |
| method.return_value = 'matriz' |
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
| server { | |
| ... | |
| location /static/ { | |
| alias /opt/myenv/static/; | |
| } | |
| location / { | |
| ... | |
| } |
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
| var widget = angular.module('Widget', ['angularCharts']); | |
| widget.controller('WidgetCtrl', ['$scope', function($scope){ | |
| $scope.config = { | |
| title: 'Products', | |
| tooltips: true, | |
| labels: false, | |
| mouseover: function() {}, | |
| mouseout: function() {}, | |
| click: function() {}, |
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 MyForm(forms.Form): | |
| name = 'My Form Name' |