Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Could not parse the remainder in Template? [RSS Feed]

#1 March 27, 2008 06:48:21

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

Could not parse the remainder in Template?


I tried using {{ candidate.vote_set.filter(vote='TU').count()}} in my
view_candidate.html file
but it gives me error
Could not parse the remainder: (vote='TU').count()

please help me out..
Thanks...

django wrote:
> hi,
> I have a candidate model and a voting model.
> Voting model is basically thumps up and down.
>
> I want to show my voting status in my Candidate profile..
> Right now this is what I am doing
> 1) /template/ candidate/view_candidatelist.html
> 2) /template/vote/ view_vote.html
>
> view_candidatelist gives me the list of candidate.
> view_vote/<candidate_id> gives me the voting status for that
> particular candidate and the view function takes candidate_id as an
> argument..
>
> My question is how can I display my voting status in my candidatelist.
>
> View function for vote return the:
> render_to_response('templates/vote/view_vote.html',
> {'thumbsup_count': tu_count,
> 'thumbsdown_count':td_count}
>
> view function for candidate:
> return render_to_response('templates/view_candidatelist.html',
>
> {'candidateprofile_list':candidateprofile_list})
>
> So what should I do to display voting status in candidatelist????
> I tried using {% include "template/view_vote.html %} but it doent
> seems to work..
>
> 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-users@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#2 March 27, 2008 07:12:12

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

Could not parse the remainder in Template?


How do i convert {{ candidate.vote_set.filter(vote='TU').count()}} in
my view_candidate to work it properly ????
Right now it give me templatesyntax error
On Mar 27, 10:48 am, django <> wrote:
> I tried using {{ candidate.vote_set.filter(vote='TU').count()}} in my
> view_candidate.html file
> but it gives me error
> Could not parse the remainder: (vote='TU').count()
>
> please help me out..
> Thanks...
>
> django wrote:
> > hi,
> > I have a candidate model and a voting model.
> > Voting model is basically thumps up and down.
>
> > I want to show my voting status in my Candidate profile..
> > Right now this is what I am doing
> > 1) /template/ candidate/view_candidatelist.html
> > 2) /template/vote/ view_vote.html
>
> > view_candidatelist gives me the list of candidate.
> > view_vote/<candidate_id> gives me the voting status for that
> > particular candidate and the view function takes candidate_id as an
> > argument..
>
> > My question is how can I display my voting status in my candidatelist.
>
> > View function for vote return the:
> > render_to_response('templates/vote/view_vote.html',
> > {'thumbsup_count': tu_count,
> > 'thumbsdown_count':td_count}
>
> > view function for candidate:
> > return render_to_response('templates/view_candidatelist.html',
>
> > {'candidateprofile_list':candidateprofile_list})
>
> > So what should I do to display voting status in candidatelist????
> > I tried using {% include "template/view_vote.html %} but it doent
> > seems to work..
>
> > 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-users@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#3 March 27, 2008 09:15:29

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

Could not parse the remainder in Template?


On Thu, Mar 27, 2008 at 1:12 AM, django <> wrote:
> How do i convert {{ candidate.vote_set.filter(vote='TU').count()}} in
> my view_candidate to work it properly ????
> Right now it give me templatesyntax error

Quoting the "Philosophy" section at the top of this page:http://www.djangoproject.com/documentation/templates/------------------

"If you have a background in programming, or if you're used to
languages like PHP which mix programming code directly into HTML,
you'll want to bear in mind that the Django template system is not
simply Python embedded into HTML. This is by design: the template
system is meant to express presentation, not program logic."

"The Django template system provides tags which function similarly to
some programming constructs — an {% if %} tag for boolean tests, a {%
for %} tag for looping, etc. — but these are not simply executed as
the corresponding Python code, and the template system will not
execute arbitrary Python expressions. Only the tags, filters and
syntax listed below are supported by default (although you can add
your own extensions to the template language as needed)."

------------------

This suggests an answer to why the things you're trying don't work
(the template system isn't just Python mixed into HTML, and so
arbitrary Python function calls don't work), and offers some ideas on
where to turn to get something that works (write a custom tag or, if
this is a common need, write a custom method on your model which
returns the value you want).



--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#4 March 27, 2008 10:15:21

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

Could not parse the remainder in Template?


Thanks ..

On Mar 27, 1:15 pm, "James Bennett" <> wrote:
> On Thu, Mar 27, 2008 at 1:12 AM, django <> wrote:
> > How do i convert {{ candidate.vote_set.filter(vote='TU').count()}} in
> > my view_candidate to work it properly ????
> > Right now it give me templatesyntax error
>
> Quoting the "Philosophy" section at the top of this page:
>
>http://www.djangoproject.com/documentation/templates/>
> ------------------
>
> "If you have a background in programming, or if you're used to
> languages like PHP which mix programming code directly into HTML,
> you'll want to bear in mind that the Django template system is not
> simply Python embedded into HTML. This is by design: the template
> system is meant to express presentation, not program logic."
>
> "The Django template system provides tags which function similarly to
> some programming constructs -- an {% if %} tag for boolean tests, a {%
> for %} tag for looping, etc. -- but these are not simply executed as
> the corresponding Python code, and the template system will not
> execute arbitrary Python expressions. Only the tags, filters and
> syntax listed below are supported by default (although you can add
> your own extensions to the template language as needed)."
>
> ------------------
>
> This suggests an answer to why the things you're trying don't work
> (the template system isn't just Python mixed into HTML, and so
> arbitrary Python function calls don't work), and offers some ideas on
> where to turn to get something that works (write a custom tag or, if
> this is a common need, write a custom method on your model which
> returns the value you want).
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

  • Root
  • » Django
  • » Could not parse the remainder in Template? [RSS Feed]

Board footer

Moderator control

Enjoy the 16th of December
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