thank you very much mr-gladys for this effort
this is view
def results(request, poll_id):
p = get_object_or_404(Poll, pk=poll_id)
choices = p.choice_set.all()
total_poll_votes = sum(c.votes for c in choices)
percentage = {}
for choice in choices:
vote = choice.votes
For easy reference, models are pasted below.
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(m
April Fools joke right? :-) HA HA LOL!
On Apr 1, 1:00 am, cha wrote:
> Im waiting
Toodle-l..
creecode
--
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 unsu
ok .. i know it's the amount of votes for option
how can I get it in python
--
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
djang
On Fri, 2011-04-01 at 01:00 -0700, cha wrote:
> Im waiting
for what?
--
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email
Wow thats rude,
poll_votes = the amount of votes for option a/b/c/d etc.
On Apr 1, 9:00 am, cha wrote:
> Im waiting
--
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 unsubsc
Im waiting
--
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 thi
thanx
I have Reached the following
total_poll_votes = sum(c.votes for c in p.choice_set.all())
poll_votes = ??
vote_percentage = (poll_votes/total_poll_votes)*100
i just need poll_votes
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To pos
^^ This would apply per poll.
On Thu, Mar 31, 2011 at 4:50 PM, Sithembewena Lloyd Dube
wrote:
> Hi there,
>
> I think that you would need to get the count of votes for each poll, add
> all votes and use the formula:
>
> vote_percentage = (poll_votes/total_poll_votes)*100
>
>
>
> On Thu, Mar 31, 2
Hi there,
I think that you would need to get the count of votes for each poll, add all
votes and use the formula:
vote_percentage = (poll_votes/total_poll_votes)*100
On Thu, Mar 31, 2011 at 8:33 AM, cha wrote:
> ok in beginning
> how i can get percentage for each vote ?
>
> this result code
>
ok in beginning
how i can get percentage for each vote ?
this result code
def results(request, poll_id):
p = get_object_or_404(Poll, pk=poll_id)
return render_to_response('polls/results.html', {'poll': p})
--
You received this message because you are subscribed to the Google Groups
11 matches
Mail list logo