Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » custom template tags with a raw query [RSS Feed]

#1 June 14, 2010 21:10:22

C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

custom template tags with a raw query


Hello again,

My last question may have been unclear, so I'm going to be more
specific.

I want to use the results of this:
cursor.execute("SELECT * from sp_getreport(""varchar"" %s)", )

(or something similar) In a custom template tag to display in a
template. The results of the query are:
a user name, a message, an address, a date, and a primary key.

I've read any number of articles on the topic, but I'm still having
trouble understanding how to create the necessary custom tags to
accomplish this. How would I go about writing this?

-Cole

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 15, 2010 10:47:12

Vasil V.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

custom template tags with a raw query


To use custom SQL see this for reference:http://docs.djangoproject.com/en/dev/topics/db/sql/To create a templatetag see this for reference:http://docs.djangoproject.com/en/dev/howto/custom-template-tags/On Mon, Jun 14, 2010 at 10:08 PM, Cole743 <cole.rieger...@gmail.com> wrote:
> Hello again,
>
> My last question may have been unclear, so I'm going to be more
> specific.
>
> I want to use the results of this:
> cursor.execute("SELECT * from sp_getreport(""varchar"" %s)", )
>
> (or something similar) In a custom template tag to display in a
> template. The results of the query are:
> a user name, a message, an address, a date, and a primary key.
>
> I've read any number of articles on the topic, but I'm still having
> trouble understanding how to create the necessary custom tags to
> accomplish this. How would I go about writing this?
>
> -Cole
>
> --
> 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.
>
>

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 June 16, 2010 20:15:41

C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

custom template tags with a raw query


The first link I had seen and used. My custom query works, I had just
been having issues with the tags. I had been through the docs and seen
a different one on tags, but apparently passed over the one you posted
in the link. It filled in some of the gaps I was missing, thanks. Very
helpful.

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » custom template tags with a raw query [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support