Providing a custom DataGrid like this would be a nice addition to Djblets. I
probably won't be able to spend any time fine-tuning this, but it looks like
you have a good start. If we got this polished up, I'd definitely include it
in Djblets.

I'd also like to have something like this in django.contrib, but this seems
like one of those components that would need wide buy-in in order for it to
be accepted as part of Django.

Christian

-- 
Christian Hammond - chip...@chipx86.com
Review Board - http://www.review-board.org
VMware, Inc. - http://www.vmware.com


On Sun, Feb 22, 2009 at 2:42 AM, Kless <jonas....@googlemail.com> wrote:

>
> Building a datagrid is too verbose and we're repeating data that it
> has been already set in the models. So could use those metadata.
>
> -----------------
> class TableDataGrid(grids.DataGrid):
>   model = models.Table
>   meta = model._meta
>   fields = [field.name for field in meta._fields()]
>
>   # ### This faills. But the idea is to execute dinamically all
> fields.
>   data = {}
>   for field in meta._fields():
>      name = field.name
>      if 'id' in name:
>         name = 'pk'
>      data[name] = "grids.Column(%s)" % unicode(field.verbose_name)
>   # ###
>
>   def __init__(self, request):
>      grids.DataGrid.__init__(self, request, self.model.objects.all(),
>
> self.meta.verbose_name_plural.title)
>      self.default_sort = self.meta.ordering
>      self.default_columns = self.fields
> -----------------
>
> To working with metada:
> http://www.b-list.org/weblog/2007/nov/04/working-models/
>
>
> Thanks for this application. It should be in django.contribs because
> there are many people that needs anything so (and it's more powerfull
> than databrowse).
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To post to this group, send email to reviewboard@googlegroups.com
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to