https://hub.docker.com/_/django/
Deprecated
"This image is officially deprecated in favor of the standard python image, and will receive no further updates after 2016-12-31 (Dec 31, 2016). Please adjust your usage accordingly."
const pluralize = (count, singular, plural = null) => count > 1 ? plural ? plural : `${singular}s` : singular; |
const maskPhone = (phone) => phone.replace(/^(\d{2})(\d{4,5})(\d{4})$/, '($1) $2-$3'); |
function validateCns(cns) { | |
cns = cns.replace(/\D/g, ''); | |
if (cns.length != 15) { | |
return false; | |
} | |
const primeiroDigito = cns.charAt(0); | |
// Validação para CNS provisório |
<?php | |
public function distribuirLotes($resultSet) | |
{ | |
$lotes = []; | |
foreach ($resultSet as $row) { | |
$lotes = array_merge($lotes, $this->organizarIntervalos($row)); | |
} | |
courses = Course.objects.filter(published_at__lte=timezone.now()) | |
lessons_with_status = Lesson.objects.annotate( | |
is_completed=models.Case( | |
models.When( | |
models.Q(student_progress__completed_at__isnull=False) | |
& models.Q(student_progress__user=user), | |
then=models.Value(True) | |
), | |
default=models.Value(False), |
courses = Course.objects.filter(published_at__lte=timezone.now()) | |
lessons_with_status = Lesson.objects.annotate( | |
is_completed=models.Case( | |
models.When( | |
models.Q(student_progress__completed_at__isnull=False) | |
& models.Q(student_progress__user=user), | |
then=models.Value(True) | |
), | |
default=models.Value(False), |
https://hub.docker.com/_/django/
Deprecated
"This image is officially deprecated in favor of the standard python image, and will receive no further updates after 2016-12-31 (Dec 31, 2016). Please adjust your usage accordingly."
class UserObjectsMixin: | |
def get_queryset(self): | |
qs = super().get_queryset() | |
return qs.filter(usuario=self.request.user) | |
class CoisasListView(LoginRequiredMixin, UserObjectsMixon, ListView): | |
login_url = '' | |
redirect_field_name = 'redirect_to' |
class OrdemServico(models.Model): | |
funcionario = models.ForeignKey(Funcionario, verbose_name=u' Nome do Funcionario', on_delete=models.PROTECT) | |
cliente = models.ForeignKey(Cliente, verbose_name=u' Nome do Cliente', on_delete=models.PROTECT) | |
servicos = models.ManyToManyField(Servico, verbose_name=u'Servico ', on_delete=Models.PROTECT) | |
data_entrada = models.DateTimeField(verbose_name=u' Data de Entrada ', default=datetime.now, blank=True) | |
data_saida = models.DateTimeField(verbose_name=u'Data de Saida', blank=False, null=False) | |
valor_total = models.DecimalField(max_digits=7, decimal_places=2, blank=True) | |
def save(self, *args, **kwargs): | |
total = self.servicos.all().aggregate(total=models.Sum('preco'))['total'] |
import operator | |
from functools import reduce | |
@login_required | |
def busca(request): | |
config = { | |
're_avaliadoy': 're__icontains', | |
'nome_avaliadoy': 'icontains', | |
'hora_conclusao': 'exact', |