当前位置: 首页>>代码示例>>Python>>正文


Python PeriodoForm.is_valid方法代码示例

本文整理汇总了Python中invoice.forms.PeriodoForm.is_valid方法的典型用法代码示例。如果您正苦于以下问题:Python PeriodoForm.is_valid方法的具体用法?Python PeriodoForm.is_valid怎么用?Python PeriodoForm.is_valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在invoice.forms.PeriodoForm的用法示例。


在下文中一共展示了PeriodoForm.is_valid方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: SeguimientoPeriodoView

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class SeguimientoPeriodoView(TemplateView, LoginRequiredMixin):
    """Muestra los :class:`Seguimiento`s de un periodo"""
    template_name = 'clinique/seguimiento_periodo.html'

    def dispatch(self, request, *args, **kwargs):
        self.form = PeriodoForm(request.GET, prefix='seguimiento-periodo')

        if self.form.is_valid():
            self.inicio = self.form.cleaned_data['inicio']
            self.fin = datetime.combine(self.form.cleaned_data['fin'], time.max)
            self.seguimiento = Seguimiento.objects.filter(
                created__gte=self.inicio,
                created__lte=self.fin
            )
        return super(SeguimientoPeriodoView, self).dispatch(request, *args,
                                                            **kwargs)

    def get_context_data(self, **kwargs):
        context = super(SeguimientoPeriodoView, self).get_context_data(**kwargs)

        context['seguimientos'] = self.seguimiento
        context['inicio'] = self.inicio
        context['fin'] = self.fin

        context['cuenta'] = Seguimiento.objects.values(
            'paciente').annotate(
            seguimiento_count=Count('id'))

        return context
开发者ID:AngelPercy,项目名称:sysmed,代码行数:31,代码来源:views.py

示例2: ConsultaPeriodoView

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class ConsultaPeriodoView(TemplateView, LoginRequiredMixin):
    """Muestra las opciones disponibles para la aplicación"""

    template_name = 'clinique/consulta_list.html'

    def dispatch(self, request, *args, **kwargs):
        """Filtra las :class:`Emergencia` de acuerdo a los datos ingresados en
        el formulario"""

        self.form = PeriodoForm(request.GET, prefix='consulta')
        if self.form.is_valid():
            self.inicio = self.form.cleaned_data['inicio']
            self.fin = datetime.combine(self.form.cleaned_data['fin'], time.max)
            self.consultas = Consulta.objects.filter(
                created__range=(self.inicio, self.fin)
            )
        else:
            return redirect('invoice-index')

        return super(ConsultaPeriodoView, self).dispatch(request, *args,
                                                         **kwargs)

    def get_context_data(self, **kwargs):

        """Permite utilizar las :class:`Emergencia`s en la vista"""

        context = super(ConsultaPeriodoView, self).get_context_data(**kwargs)
        context['consultas'] = self.consultas
        context['inicio'] = self.inicio
        context['fin'] = self.fin
        return context
开发者ID:AngelPercy,项目名称:sysmed,代码行数:33,代码来源:views.py

示例3: CargoPeriodoView

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class CargoPeriodoView(TemplateView, LoginRequiredMixin):
    """Muestra los :class:`Cargo` de un periodo"""
    template_name = 'clinique/cargo_periodo.html'

    def dispatch(self, request, *args, **kwargs):
        self.form = PeriodoForm(request.GET, prefix='cargo-periodo')

        if self.form.is_valid():
            self.inicio = self.form.cleaned_data['inicio']
            self.fin = datetime.combine(self.form.cleaned_data['fin'], time.max)
            self.cargos = Cargo.objects.filter(
                created__gte=self.inicio,
                created__lte=self.fin
            )
        return super(CargoPeriodoView, self).dispatch(request, *args, **kwargs)

    def get_context_data(self, **kwargs):
        context = super(CargoPeriodoView, self).get_context_data(**kwargs)

        context['cargos'] = self.cargos
        context['inicio'] = self.inicio
        context['fin'] = self.fin

        context['cuenta'] = ItemTemplate.objects.values('descripcion').annotate(
            cargo_count=Count('consultorio_cargos')).filter(
            consultorio_cargos__created__gte=self.inicio,
            consultorio_cargos__created__lte=self.fin)

        return context
开发者ID:AngelPercy,项目名称:sysmed,代码行数:31,代码来源:views.py

示例4: EvaluacionPeriodoView

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class EvaluacionPeriodoView(TemplateView, LoginRequiredMixin):
    """Muestra los :class:`Evaluacion` de un periodo"""
    template_name = 'clinique/evaluacion_periodo.html'

    def dispatch(self, request, *args, **kwargs):
        self.form = PeriodoForm(request.GET, prefix='evaluacion-periodo')

        if self.form.is_valid():
            self.inicio = self.form.cleaned_data['inicio']
            self.fin = datetime.combine(self.form.cleaned_data['fin'], time.max)
            self.evaluaciones = Evaluacion.objects.filter(
                created__gte=self.inicio,
                created__lte=self.fin
            ).order_by('paciente__consultorio')
        return super(EvaluacionPeriodoView, self).dispatch(request, *args,
                                                           **kwargs)

    def get_context_data(self, **kwargs):
        context = super(EvaluacionPeriodoView, self).get_context_data(**kwargs)

        context['evaluaciones'] = self.evaluaciones
        context['inicio'] = self.inicio
        context['fin'] = self.fin

        return context
开发者ID:AngelPercy,项目名称:sysmed,代码行数:27,代码来源:views.py

示例5: AdmisionPeriodoView

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class AdmisionPeriodoView(TemplateView, LoginRequiredMixin):
    def dispatch(self, request, *args, **kwargs):

        """Filtra las :class:`Admision` de acuerdo a los datos ingresados en
        el formulario"""

        self.form = PeriodoForm(request.GET, prefix='admisiones')
        if self.form.is_valid():

            inicio = self.form.cleaned_data['inicio']
            fin = self.form.cleaned_data['fin']
            self.inicio = datetime.combine(inicio, time.min)
            self.fin = datetime.combine(fin, time.max)
            self.admisiones = Admision.objects.filter(
                admision__range=(inicio, fin))

        else:

            return redirect('admision-index')

        return super(AdmisionPeriodoView, self).dispatch(request, *args,
                                                         **kwargs)

    def get_context_data(self, **kwargs):

        context = super(AdmisionPeriodoView, self).get_context_data(**kwargs)
        context['inicio'] = self.inicio
        context['fin'] = self.fin
        context['admisiones'] = self.admisiones

        return context
开发者ID:AngelPercy,项目名称:sysmed,代码行数:33,代码来源:views.py

示例6: ContratoPeriodoView

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class ContratoPeriodoView(TemplateView, LoginRequiredMixin):
    """Muestra los contratos de un periodo"""
    template_name = 'contracts/periodo.html'

    def dispatch(self, request, *args, **kwargs):
        self.form = PeriodoForm(request.GET, prefix='contrato-periodo')

        if self.form.is_valid():
            self.inicio = self.form.cleaned_data['inicio']
            self.fin = datetime.combine(self.form.cleaned_data['fin'], time.max)
            self.contratos = Contrato.objects.filter(
                inicio__gte=self.inicio,
                inicio__lte=self.fin,
            )
        return super(ContratoPeriodoView, self).dispatch(request, *args,
                                                         **kwargs)

    def get_context_data(self, **kwargs):
        context = super(ContratoPeriodoView, self).get_context_data(**kwargs)

        context['contratos'] = self.contratos
        context['inicio'] = self.inicio
        context['fin'] = self.fin

        return context
开发者ID:luisdavid1962,项目名称:hospicloud,代码行数:27,代码来源:views.py

示例7: PagoPeriodoView

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class PagoPeriodoView(TemplateView):
    """Obtiene los :class:`Recibo` de un periodo determinado en base
    a un formulario que las clases derivadas deben proporcionar como
    self.form"""
    template_name = 'invoice/pago_periodo.html'

    def dispatch(self, request, *args, **kwargs):
        """Efectua la consulta de los :class:`Recibo` de acuerdo a los
        datos ingresados en el formulario"""

        self.form = PeriodoForm(request.GET, prefix='pago')

        if self.form.is_valid():
            self.inicio = self.form.cleaned_data['inicio']
            self.fin = self.form.cleaned_data['fin']

        return super(PagoPeriodoView, self).dispatch(request, *args, **kwargs)

    def get_context_data(self, **kwargs):
        context = super(PagoPeriodoView, self).get_context_data(**kwargs)
        pagos = Pago.objects.filter(
            recibo__created__range=(self.inicio, self.fin))
        context['group'] = pagos.values('tipo__nombre').annotate(
            monto=Sum('monto')
        ).order_by()
        context['pagos'] = pagos
        context['total'] = pagos.aggregate(total=Sum('monto'))

        context['inicio'] = self.inicio
        context['fin'] = self.fin
        return context
开发者ID:AngelPercy,项目名称:sysmed,代码行数:33,代码来源:views.py

示例8: EstadisticasPeriodoView

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class EstadisticasPeriodoView(TemplateView):
    """Obtiene los :class:`Recibo` de un periodo determinado en base
    a un formulario que las clases derivadas deben proporcionar como
    self.form"""
    template_name = 'invoice/estadisticas_periodo.html'

    def dispatch(self, request, *args, **kwargs):
        """Efectua la consulta de los :class:`Recibo` de acuerdo a los
        datos ingresados en el formulario"""

        self.form = PeriodoForm(request.GET, prefix='estadisticas')

        if self.form.is_valid():
            self.inicio = self.form.cleaned_data['inicio']
            self.fin = self.form.cleaned_data['fin']

        return super(EstadisticasPeriodoView, self).dispatch(request, *args, **kwargs)

    def get_context_data(self, **kwargs):
        context = super(EstadisticasPeriodoView, self).get_context_data(**kwargs)

        context['pagos'] = []

        total = Recibo.objects.annotate(sold=Sum('ventas__total')).filter(
            created__range=(self.inicio, self.fin)
        ).aggregate(total=Sum('sold'))['total']

        ventas = Venta.objects.filter(
            recibo__created__range=(self.inicio, self.fin))
        context['ventas'] = ventas.values('item__descripcion').annotate(
            monto=Sum('monto'),
            cantidad=Sum('cantidad')
        ).order_by('-monto')[:20]

        if total is None:
            total = Decimal()

        context['recibos'] = total

        for tipo in TipoPago.objects.all():

            pagado = tipo.pagos.filter(
                recibo__created__range=(self.inicio, self.fin)
            ).aggregate(total=Sum('monto'))['total']
            if pagado is None:
                pagado = Decimal()

            context['pagos'].append((tipo, pagado))

        context['inicio'] = self.inicio
        context['fin'] = self.fin
        return context
开发者ID:AngelPercy,项目名称:sysmed,代码行数:54,代码来源:views.py

示例9: EmergenciaPeriodo

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class EmergenciaPeriodo(TemplateView):
    template_name = 'estadisticas/emergencia.html'

    def dispatch(self, request, *args, **kwargs):

        """Filtra las :class:`Admision` de acuerdo a los datos ingresados en
        el formulario"""

        self.form = PeriodoForm(request.GET, prefix='emergencia')
        if self.form.is_valid():

            self.inicio = self.form.cleaned_data['inicio']
            self.fin = datetime.combine(self.form.cleaned_data['fin'], time.max)
            self.emergencias = Emergencia.objects.filter(
                created__gte=self.inicio,
                created__lte=self.fin
            )

        else:

            return redirect('estadisticas')

        return super(EmergenciaPeriodo, self).dispatch(request, *args,
                                                       **kwargs)

    def get_context_data(self, **kwargs):

        context = super(EmergenciaPeriodo, self).get_context_data(**kwargs)
        context['inicio'] = self.inicio
        context['fin'] = self.fin
        context['emergencias'] = self.emergencias
        # Calcular todos los cargos efectuados en estas emergencias
        cargos = defaultdict(Decimal)

        doctores = defaultdict(int)
        for emergencia in self.emergencias:

            for cobro in emergencia.cobros.all():
                cargos[cobro.cargo] += cobro.cantidad
            doctores[emergencia.usuario] += 1

        context['cargos'] = cargos.items()

        context['doctores'] = reversed(
            sorted(doctores.items(), key=lambda x: x[1]))
        context['grafico'] = reversed(
            sorted(doctores.items(), key=lambda x: x[1]))
        context['grafico2'] = reversed(
            sorted(doctores.items(), key=lambda x: x[1]))
        context['total'] = sum(e.total() for e in self.emergencias)
        return context
开发者ID:Exian,项目名称:hospicloud,代码行数:53,代码来源:views.py

示例10: DiagnosticoPeriodoView

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class DiagnosticoPeriodoView(TemplateView, LoginRequiredMixin):
    """Muestra los :class:`DiagnosticoClinico` de un periodo"""
    template_name = 'clinique/diagnostico_periodo.html'

    def dispatch(self, request, *args, **kwargs):
        self.form = PeriodoForm(request.GET, prefix='diagnostico-periodo')

        if self.form.is_valid():
            self.inicio = self.form.cleaned_data['inicio']
            self.fin = datetime.combine(self.form.cleaned_data['fin'], time.max)
            self.diagnosticos = DiagnosticoClinico.objects.filter(
                created__gte=self.inicio,
                created__lte=self.fin
            ).order_by('paciente__consultorio')
        return super(DiagnosticoPeriodoView, self).dispatch(request, *args,
                                                            **kwargs)

    def get_context_data(self, **kwargs):
        context = super(DiagnosticoPeriodoView, self).get_context_data(**kwargs)

        context['diagnosticos'] = self.diagnosticos
        context['inicio'] = self.inicio
        context['fin'] = self.fin
        context['total'] = self.diagnosticos.count()

        DiagnosticoClinico.objects.values('paciente__consultorio').annotate(
            consultorio_count=Count('paciente__consultorio')
        ).filter(created__gte=self.inicio, created__lte=self.fin)

        cons = defaultdict(int)
        consultorios = Consultorio.objects.all()
        for consultorio in consultorios:
            cons[consultorio] = DiagnosticoClinico.objects.filter(
                created__gte=self.inicio, created__lte=self.fin,
                paciente__consultorio=consultorio).count()

        cons = dict((k, v) for k, v in cons.items() if v > 0)

        context['consultorios'] = reversed(
            sorted(cons.iteritems(), key=lambda x: x[1]))
        context['consultorio_graph'] = reversed(
            sorted(cons.iteritems(), key=lambda x: x[1]))
        context['consultorio_graph2'] = reversed(
            sorted(cons.iteritems(), key=lambda x: x[1]))

        return context
开发者ID:AngelPercy,项目名称:sysmed,代码行数:48,代码来源:views.py

示例11: EventoPeriodoView

# 需要导入模块: from invoice.forms import PeriodoForm [as 别名]
# 或者: from invoice.forms.PeriodoForm import is_valid [as 别名]
class EventoPeriodoView(TemplateView, LoginRequiredMixin):
    """Muestra los :class:`Evento`s de un periodo"""

    template_name = "contracts/periodo.html"

    def dispatch(self, request, *args, **kwargs):
        self.form = PeriodoForm(request.GET, prefix="evento-periodo")

        if self.form.is_valid():
            self.inicio = self.form.cleaned_data["inicio"]
            self.fin = datetime.combine(self.form.cleaned_data["fin"], time.max)
            self.eventos = Evento.objects.filter(fecha__gte=self.inicio, fecha__lte=self.fin)
        return super(EventoPeriodoView, self).dispatch(request, *args, **kwargs)

    def get_context_data(self, **kwargs):
        context = super(EventoPeriodoView, self).get_context_data(**kwargs)

        context["contratos"] = self.contratos
        context["inicio"] = self.inicio
        context["fin"] = self.fin

        return context
开发者ID:vivisant80,项目名称:hospicloud,代码行数:24,代码来源:views.py


注:本文中的invoice.forms.PeriodoForm.is_valid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。