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.

Reply via email to