コード例 #1
0
class Bootstrap3AccordionPlugin(CMSPlugin):
    """
    JavaScript - Collapse: "Accordion" Model
    http://getbootstrap.com/javascript/#collapse
    """
    index = models.PositiveIntegerField(
        verbose_name=_('Index'),
        null=True,
        blank=True,
        help_text=_('Index of element to open on page load (optional).'),
    )
    classes = model_fields.Classes()
    attributes = AttributesField(
        verbose_name=_('Attributes'),
        blank=True,
        excluded_keys=['class'],
    )

    cmsplugin_ptr = model_fields.CMSPluginField()

    def get_short_description(self):
        instance = self.get_plugin_instance()[0]

        if not instance:
            return ugettext('<empty>')

        column_count = len(self.child_plugin_instances or [])
        column_count_str = ungettext('1 item', '%(count)i items',
                                     column_count) % {
                                         'count': column_count
                                     }
        return column_count_str

    def __str__(self):
        return str(self.index)
コード例 #2
0
class Bootstrap3TabPlugin(CMSPlugin):
    """
    JavaScript - Tab: "Wrapper" Model
    http://getbootstrap.com/javascript/#tabs
    """
    TAB_TYPE_CHOICES = (
        ('nav-tabs', _('Tabs')),
        ('nav-tabs nav-justified', _('Tabs justified')),
        ('nav-pills', _('Pills')),
        ('nav-pills nav-justified', _('Pills justified')),
    )
    TAB_EFFECT_CHOICES = (
        ('fade', _('Fade')),
    )

    index = models.PositiveIntegerField(
        verbose_name=_('Index'),
        null=True,
        blank=True,
        help_text=_('Index of element to open on page load (optional).'),
    )
    style = models.CharField(
        verbose_name=_('Display type'),
        choices=TAB_TYPE_CHOICES,
        default=TAB_TYPE_CHOICES[0][0],
        max_length=255,
    )
    effect = models.CharField(
        verbose_name=_('Animation effect'),
        choices=TAB_EFFECT_CHOICES,
        blank=True,
        max_length=255,
    )
    classes = model_fields.Classes()
    attributes = AttributesField(
        verbose_name=_('Attributes'),
        blank=True,
        excluded_keys=['class'],
    )

    cmsplugin_ptr = model_fields.CMSPluginField()

    def __str__(self):
        return '{} {}'.format(self.style, self.effect)
コード例 #3
0
class BradescoBilletDataAdminForm(forms.ModelForm):

    cedente_cnpj = fields.CNPJField(
        widget=forms.TextInput(attrs={
            "mask": "99.999.999/9999-99",
        }))  #, validators=[CNPJValidator]  )
    sacadoravalista_cnpj = fields.CNPJField(
        widget=forms.TextInput(attrs={
            "mask": "99.999.999/9999-99",
        }))  #, validators=[CNPJValidator] )
    enderecosacaval_cep = forms.CharField(widget=forms.TextInput(
        attrs={
            "mask": "99999-999",
        }))
    contabancaria_numerodaconta = forms.CharField(widget=forms.TextInput(
        attrs={
            "mask": "999999",
        }))
    contabancaria_numerodaconta_digito = forms.CharField(
        widget=forms.TextInput(attrs={
            "mask": "9",
        }))
    contabancaria_agencia = forms.CharField(widget=forms.TextInput(
        attrs={
            "mask": "9999",
        }))
    contabancaria_agencia_digito = forms.CharField(widget=forms.TextInput(
        attrs={
            "mask": "9",
        }))
    #titulo_digitodonossonumero = forms.CharField(widget = forms.TextInput(attrs={"mask": "9",}) )

    #titulo_nossonumero = models.CharField(max_length=20, null=False, blank=False, validators=[MinLengthValidator(11)])
    cedente_nome = models.CharField(max_length=255, null=False, blank=False)
    sacadoravalista_nome = models.CharField(max_length=255,
                                            null=False,
                                            blank=False)
    enderecosacaval_bairro = models.CharField(max_length=255,
                                              null=False,
                                              blank=False)
    enderecosacaval_logradouro = models.CharField(max_length=255,
                                                  null=False,
                                                  blank=False)
    enderecosacaval_numero = models.CharField(max_length=20,
                                              null=False,
                                              blank=False)
    enderecosacaval_uf = models.ForeignKey(State, null=False, blank=False)
    enderecosacaval_localidade = ChainedForeignKey(
        City,
        chained_field='enderecosacaval_uf',
        chained_model_field='state',
        null=False,
        blank=False)
    contabancaria_carteira = models.PositiveIntegerField(
        null=False, blank=False, validators=[MaxValueValidator(99)])
    cedente_nome.verbose_name = _("Seller's name")
    cedente_nome.help_text = _("Seller (company that will receive the money).")
    cedente_cnpj.label = _("Seller's CNPJ")
    cedente_cnpj.help_text = ""
    sacadoravalista_nome.label = _("Guarantor's name")
    sacadoravalista_nome.help_text = _(
        "Guarantor (the person that takes responsibility over the transaction)."
    )
    sacadoravalista_cnpj.label = _("Guarantor's CNPJ")
    sacadoravalista_cnpj.help_text = ""
    enderecosacaval_uf.label = _("State")
    enderecosacaval_uf.help_text = _("State where the the guarantor lives.")
    enderecosacaval_localidade.label = _("City")
    enderecosacaval_localidade.help_text = _(
        "City where the the guarantor lives.")
    enderecosacaval_cep.label = _("CEP")
    enderecosacaval_cep.help_text = _("CEP - Postal code")
    enderecosacaval_bairro.label = _("District")
    enderecosacaval_bairro.help_text = _("District where the guarantor lives")
    enderecosacaval_logradouro.label = _("Street")
    enderecosacaval_logradouro.help_text = _(
        "Street where the guarantor lives.")
    enderecosacaval_numero.label = _("Number")
    enderecosacaval_numero.help_text = _(
        "Number of the house where the guarantor lives.")
    contabancaria_numerodaconta.label = _("Account")
    contabancaria_numerodaconta.help_text = _(
        "Number of the bank account of the seller.")
    contabancaria_numerodaconta_digito.label = _("Verifier digit")
    contabancaria_numerodaconta_digito.help_text = _(
        "Verifier digit of the bank account of the seller.")
    contabancaria_carteira.label = _("Seller's wallet")
    contabancaria_carteira.help_text = _("Seller's bank wallet number")
    contabancaria_agencia.label = _("Agency")
    contabancaria_agencia.help_text = _("Seller's account agency")
    contabancaria_agencia_digito.label = _("Agency digit")
    contabancaria_agencia_digito.help_text = _(
        "Seller's account agency verifier digit")

    #titulo_nossonumero.label = _("\"Our number\"")
    #titulo_nossonumero.help_text = _("Number registered in Bradesco to register the receiving of billets.")
    #titulo_digitodonossonumero.label = _("\"Our number\" digit")
    #titulo_digitodonossonumero.help_text = _("\"Our number\" digit")

    class Meta:
        model = BradescoBilletData

    class Media:
        js = (
            settings.MEDIA_URL + "js/jquery.maskedinput-1.1.3.admin.js",
            settings.MEDIA_URL + "js/boleto.admin.js",
        )
        css = {"all": (settings.MEDIA_URL + "css/boleto.admin.css", )}