asifpy / django-crudbuilder

Generic CRUD implementation in Django
https://django-crudbuilder.readthedocs.org/en/latest/index.html
Apache License 2.0
193 stars 67 forks source link

Pagination does't work #6

Closed marcoshemann closed 8 years ago

marcoshemann commented 8 years ago

Hi, I use tables2_pagination = 10 But in list view show me 25 row. May you check this. Tank you

asifpy commented 8 years ago

Can you please send me your ModelCrud class.

marcoshemann commented 8 years ago

of corse, i try in more that one models.

class Plano(models.Model): nome = models.CharField("Nome do Plano", max_length=50) valor_mensal = models.DecimalField("Valor Mensal", max_digits=8, decimal_places=2, default=0) valor_ativacao = models.DecimalField("Valor da Ativação", max_digits=8, decimal_places=2,default=0 ) valor_coletor = models.DecimalField("Valor do Coletor", max_digits=8, decimal_places=2, default=0) sit = models.IntegerField("Situação", choices=GLOBAL_STATUS, default = 1) sit_web = models.IntegerField(choices=GLOBAL_STATUS, default = 1) nr_coletores = models.IntegerField("Número de Coletores", default=1) nr_hosts = models.IntegerField("Número de Host's", default=100) promocode = models.CharField("Código Promocional", max_length=50, blank=True, null=True,) valido_ate = models.DateTimeField("Vencimento", default=timezone.now) frequencia = models.IntegerField("Frequencia Cobrança", default=1)

class Meta:
    ordering = ['nome']
    verbose_name = 'plano'
    verbose_name_plural = 'planos'

def __str__(self):
    return self.nome

class PlanoCrud(BaseCrudBuilder): model = Plano search_feilds = ['nome'] tables2_fields = ('nome', 'valor_mensal', 'sit')

tables2_css_class = "table table-bordered table-condensed"

tables2_css_class = "table table-bordered table-striped dataTable"
tables2_pagination = 4  # default is 10

modelform_excludes = ['created_by', 'updated_by']

login_required=True
permission_required=False
custom_modelform = PlanoForm
custom_templates = {
    'list': 'cadastro/crud/crud_list.html',
   # 'create': 'cadastro/crud/crud_create.html',
    'create': 'cadastro/cadC.html',
    'detail': 'cadastro/crud/crud_detail.html',
    'update': 'cadastro/cadC.html',
    'delete': 'cadastro/crud/crud_delete.html'
    }
asifpy commented 8 years ago

Pagination bug has been resolved here : https://github.com/asifpy/django-crudbuilder/commit/40c0b8dca58b7cc1d52ac713e5d3ce23487f4cd5