Re: Best way to get data into a HTML table?
Yes, I finished the tutorial, and it was very informative, but I could not find in the documentation anything about getting fields from a model, like Justin had suggested. It seems like his solution might work, but it seems a bit hackish (underscores mean private data right?). I wonder if thats how the admin app did it. Thanks anyways, I will probably end up using this solution :) On Jul 17, 9:33 am, Carl Nobilewrote: > David, > > The best thing to do is use the Django docs, maybe do their tutorial. > > The link below should get you there: > > http://docs.djangoproject.com/en/1.2/ > > ~Carl > > On Jul 17, 3:00 am, david wrote: > > > Hello, > > Just learning about Django, and I would like to know what the best > > way to generate a table from my data, similar to what the "admin" app > > does. I attempted to dig into the source of the admin app, but I was > > unable to achieve much. > > > I don't want to create a template that has for loops that list all of > > my data model's fields, instead, i want it to somehow generate all of > > the public fields in my data model. > > > Any help is greatly appreciated, thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Best way to get data into a HTML table?
David, The best thing to do is use the Django docs, maybe do their tutorial. The link below should get you there: http://docs.djangoproject.com/en/1.2/ ~Carl On Jul 17, 3:00 am, davidwrote: > Hello, > Just learning about Django, and I would like to know what the best > way to generate a table from my data, similar to what the "admin" app > does. I attempted to dig into the source of the admin app, but I was > unable to achieve much. > > I don't want to create a template that has for loops that list all of > my data model's fields, instead, i want it to somehow generate all of > the public fields in my data model. > > Any help is greatly appreciated, thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Best way to get data into a HTML table?
Each model has a meta attribute with a list of fields on it; for a Photo model, for example, you can use Photo._meta.fields. This means you could do something (at least in the shell) like: >>> fields = Photo._meta.fields >>> photo = Photo.objects.latest() >>> for field in fields: ... print '%s: %s' % (field.name, photo.__getattribute__(field.name)) and get a list of all of photo's field names and values. I'm not sure how best to do this in a template yet, but it shouldn't be that hard to figure out. HTH, Justin On Jul 17, 4:11 am, Kenneth Gonsalveswrote: > On Saturday 17 July 2010 12:30:19 david wrote: > > > Just learning about Django, and I would like to know what the best > > way to generate a table from my data, similar to what the "admin" app > > does. I attempted to dig into the source of the admin app, but I was > > unable to achieve much. > > > I don't want to create a template that has for loops that list all of > > my data model's fields, instead, i want it to somehow generate all of > > the public fields in my data model. > > best way is to create a template that has for loops that list all of your data > model's fields - that is what django is for. > -- > Regards > Kenneth Gonsalves > Senior Associate > NRC-FOSS at AU-KBC -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Best way to get data into a HTML table?
On Saturday 17 July 2010 12:30:19 david wrote: > Just learning about Django, and I would like to know what the best > way to generate a table from my data, similar to what the "admin" app > does. I attempted to dig into the source of the admin app, but I was > unable to achieve much. > > I don't want to create a template that has for loops that list all of > my data model's fields, instead, i want it to somehow generate all of > the public fields in my data model. > best way is to create a template that has for loops that list all of your data model's fields - that is what django is for. -- Regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Best way to get data into a HTML table?
Hello, Just learning about Django, and I would like to know what the best way to generate a table from my data, similar to what the "admin" app does. I attempted to dig into the source of the admin app, but I was unable to achieve much. I don't want to create a template that has for loops that list all of my data model's fields, instead, i want it to somehow generate all of the public fields in my data model. Any help is greatly appreciated, thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.