Re: submit parameters to py script
On 7-7-2012 11:44, Smaran Harihar wrote:
> Thanks for the reply Melvyn and Babatunde. So my script is, using the
> parameters, to search in a database and then spitting out the output back
> as CSV.
This only makes sense in the django world, if your script is accessing a
database that is not part of the application itself. For example an
accounting program in django that replaces a firms older software.
Access to previous years is then provided via a script that simply
provides CSV format so data can be entered into a spreadsheet program
and reports can be created. One would use this approach if converting
the old data to the new application consumes too many resources for the
few times the data will be used.
I can't think of many other cases where I would use this approach, so ...
> Ok, so adding it to view makes more sense, but how do i connect or execute
> that view, on the click of the submit button??
The key question is if you have models for the tables in this database?
If so your best option is to translate the parameters to django's
queryset syntax. If you don't understand what that means, you're
probably new to django and we'll try to be more verbose.
As a side note, especially when new to django but not unfamiliar with
webdevelopment/databases, you need to learn to let go of your SQL
knowledge and start thinking in models and querysets. Once you fully
understand how this works and what you can do with it, you can apply
your SQL knowledge to optimize what django's syncdb has created for you
or even start working the other way around using inspectdb.
--
Melvyn Sopacua
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home