https://github.com/nwinkler/atom-keyboard-shortcuts
https://github.com/zyzo/atom-cheatsheet
C is Control
# Dada a lista | |
lista = [1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 6, 6, 9, 9, 9] | |
# como eu chego na lista | |
nova_lista = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 5, 5] | |
questions_order = (1, 2, 4, 6, 8, 9) |
import xlrd | |
import xlwt | |
def salvar_xlsx(lista): | |
''' Exportar dados em XLSX ''' | |
result = lista | |
# response = HttpResponse(content_type='application/ms-excel') | |
date_ = timezone.now().strftime('%y%m%d%H%M%S') | |
filename = "/tmp/example_{}.xlsx".format(date_) | |
# response['Content-Disposition'] = 'attachment; filename=%s' % filename |
document.getElementById('get_select').addEventListener('change', function () { | |
var style = this.value == 0 ? 'none' : 'block'; | |
document.getElementById('my_div').style.display = style; | |
}); |
""" | |
Respondendo a questões feitas no grupo da live de Python. | |
""" | |
class Teste: | |
bananas_cls = 5 # Variável de classe | |
def __init__(self): | |
"""Método que inicia a instância.""" | |
self.bananas_self = 10 # Variável de instância |
<div id="app"> | |
<span data-pk='42' ref="mySpan">Meu span maneirasso</span> | |
<h2> | |
{{textMySpan}} | |
</h2> | |
</div> | |
new Vue({ | |
el: "#app", |
candidate = Candidate.objects.select_related('user') | |
candidate = candidate.values_list('stage_status__order', flat=True) | |
candidate = candidate.distinct().order_by('stage_status__order') | |
qs_choices = [('', _('Todos'))] + [(id, id) for id in candidate] | |
stage_status = forms.ChoiceField( | |
choices=qs_choices, | |
widget=forms.Select( | |
attrs={'class': 'form-control'} | |
) |
def __init__(self, *args, **kwargs): | |
self.user = kwargs.pop('user', None) | |
super(MyForm, self).__init__(*args, **kwargs) | |
if user.is_authenticated: | |
my_field = MyModel.objects.filter(user=user) | |
# ... | |
self.fields['bar'].choices = qs_choices |