Érico,

it is not really clear to me what you are trying to accomplish. That HTML
in MYVALUES is a try to show that line in the dropdown? And why is
"{{form|safe}}" there?
May you please decribe what you would like to obtain?

Cheers,

Leo



Leonardo Giordani
Author of The Digital Cat <http://lgiordani.github.com>
My profile on About.me <http://about.me/leonardo.giordani> - My GitHub
page<https://github.com/lgiordani>- My Coderwall
profile <https://coderwall.com/lgiordani>


2013/11/14 Érico Oliveira <[email protected]>

> Hy, i'm learning django.
> My idea is to give marks / votes for a selected job.
> Works but not as I would.
>
> class Job(models.Model):
>     title= models.CharField(max_length=20)
>     slug = models.SlugField(max_length=40, blank=True)
>     def __unicode__(self):
>         return self.title
>
>
> class Vote(models.Model):
>     job = models.ForeignKey(Job)
>     score = models.IntegerField(blank=True, default=0)
>
>
> my forms.py
>
> MYVALUES = (
> (5, u'<i class="fa fa-heart fa-2x"></i><span>5 </span>'), # don't work {{
> form|safe }}
> (5, five'),
> (3, u'three'),
> (2, u'two'),
> (1, u'one'),
> )
> class FormVote(forms.ModelForm):
> class Meta:
> model = Vote
> score = forms.ChoiceField(choices=MYVALUES, widget=forms.RadioSelect())
>
>
> <https://lh6.googleusercontent.com/-QVtgBBK6iqM/UoUD41aFDRI/AAAAAAAAAbw/FP4erR2SEu4/s1600/form_2.png>
>
> As I did all the html / css. I would not return the form that way.
> I tried a different approach, trying to pass the values of the vote
> through a link using jquery, but I can not mount the garvar to view the
> value of voting.
>
> It would be a mess trying to return an HTML inside FormVote, something
> like:
>
>
>
> <https://lh3.googleusercontent.com/-8ES0mhP_mHs/UoUD9G_57JI/AAAAAAAAAb4/m_S82B097W4/s1600/votes.png>
>
>
>
>
> Help?
> thanks in advance.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/736728d8-dc12-41aa-b223-7c8bed0a2cf4%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BOnEAsC_HKNHpHd9-%2BTbfbo0MogSN0R%3DztN_N2DC73W2fA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
  • votes/score Érico Oliveira
    • Re: votes/score Leonardo Giordani

Reply via email to