Re: Question about Displaying a Table

2011-06-27 Thread bruno desthuilliers
On Jun 27, 8:18 pm, Kyle Latham  wrote:
> Hello,
>
> I am pretty new to Django and Python.

Then I strongly suggest you take some time learning Python. I mean,
pure Python, without Django.

> I'm wanting to create a Django app that displays different tables in
> my MySQL database, and the user can search through the tables for info
> they want.
>
> I haven't written any code yet,

Uhuh...

> I'm doing research on the approach I
> have to take.

Knowledge comes from experience, and experience comes from practice.
Until you get some hands-on experience with both Python and Django,
your "research" is mostly a waste of time. FWIW, Django is pretty well
documented, and if you

1/ have some working experience with web programming (say, raw PHP /
MySQL, or CGI, or whatever) and
2/ do the tutorial

then you should know enough to start writing your app. Possibly not
the best way, but it still should work, and you'll learn how to
rewrite your app in better way in the process.

> Is the only way I am able to display a table from the
> MySQL database in Django by creating a template and importing the data
> to the template?

You don't even need a template - you can build the response content
how you see fit. Templates are just handy for most text (including
HTML) formatting, but that's all. And you (usually) don't "import data
to the template", you *pass* data (well, actually, python objects,
which is not quite the same thing) to the template, render it and
build a response from the result.


> Is there a another/better approach towards displaying
> a MySQL table in the Django app?

Django is not server page, it's a Model/Presentation framework. The
request/response cycle goes like:

1/ the framework finds an view matching the url pattern
2/ it calls the view with the request and possibly a couple arguments
computed from the url and the pattern
3/ the view returns a response

And that's it. The templating system is just here to help you
formatting your response's body.

Ok, it's half truth and half lie - using custom tags and context
processors you can do much more than "formatting data" with Django's
template system -, but still, Django is NOTHING like server page
systems (PHP, ASP 1.x etc), and the very core of Django is url
patterns matching, views, requests and responses. If you hope to make
the best use of Django, first learn to do things the Django way
instead of fighting against it. Trying to write PHP / ASP / whatever
server page system in Django will  be at best a very frustrating
experience.

This being said: template-driven code is *sometimes* just the
RightThing to do, and this is something you can indeed do in Django
(if you know how to) - but I don't think it's how you will better
solve your problem. FWIW, Django already has some support foer very
generic "table display / filter / search" features in the admin app,
and this is NOT template-driven code (but it's OSS so you can read the
source - but beware, serious Python knowledge required).

HTH

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Question about Displaying a Table

2011-06-27 Thread Steven Elliott Jr
Django has about the best documentation out there foe getting started. Walk 
through the tutorial and see how it goes. 

Sent from my iPhone

On Jun 27, 2011, at 2:25 PM, "Cal Leeming [Simplicity Media 
Ltd]" wrote:

> Forgive me but, the tone of this email sounds like you are asking us to do 
> this research for you :X
> 
> On Mon, Jun 27, 2011 at 7:18 PM, Kyle Latham  wrote:
> Hello,
> 
> I am pretty new to Django and Python.
> 
> I'm wanting to create a Django app that displays different tables in
> my MySQL database, and the user can search through the tables for info
> they want.
> 
> I haven't written any code yet, I'm doing research on the approach I
> have to take.  Is the only way I am able to display a table from the
> MySQL database in Django by creating a template and importing the data
> to the template? Is there a another/better approach towards displaying
> a MySQL table in the Django app?
> 
> Thank you,
> 
> Kyle
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@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.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Question about Displaying a Table

2011-06-27 Thread Cal Leeming [Simplicity Media Ltd]
Forgive me but, the tone of this email sounds like you are asking us to do
this research for you :X

On Mon, Jun 27, 2011 at 7:18 PM, Kyle Latham  wrote:

> Hello,
>
> I am pretty new to Django and Python.
>
> I'm wanting to create a Django app that displays different tables in
> my MySQL database, and the user can search through the tables for info
> they want.
>
> I haven't written any code yet, I'm doing research on the approach I
> have to take.  Is the only way I am able to display a table from the
> MySQL database in Django by creating a template and importing the data
> to the template? Is there a another/better approach towards displaying
> a MySQL table in the Django app?
>
> Thank you,
>
> Kyle
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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: Question about Displaying a Table

2011-06-27 Thread Ovnicraft
On Mon, Jun 27, 2011 at 1:18 PM, Kyle Latham  wrote:

> Hello,
>
> I am pretty new to Django and Python.
>
> I'm wanting to create a Django app that displays different tables in
> my MySQL database, and the user can search through the tables for info
> they want.
>
> I haven't written any code yet, I'm doing research on the approach I
> have to take.  Is the only way I am able to display a table from the
> MySQL database in Django by creating a template and importing the data
> to the template? Is there a another/better approach towards displaying
> a MySQL table in the Django app?
>

You can research about pagination and template system in django.

Regards,


>
> Thank you,
>
> Kyle
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@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.
>
>


-- 
Cristian Salamea
@ovnicraft

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



Question about Displaying a Table

2011-06-27 Thread Kyle Latham
Hello,

I am pretty new to Django and Python.

I'm wanting to create a Django app that displays different tables in
my MySQL database, and the user can search through the tables for info
they want.

I haven't written any code yet, I'm doing research on the approach I
have to take.  Is the only way I am able to display a table from the
MySQL database in Django by creating a template and importing the data
to the template? Is there a another/better approach towards displaying
a MySQL table in the Django app?

Thank you,

Kyle

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.