I want to have 2 buttons at the bottom of my each post like that:
I need suggestions how could I achieve that. I tried django-vote library, but it does not work for me.
My code:
<--template.html-->
<div class="post-bottom overflow">
<ul class="nav navbar-nav post-nav">
<li><a href="#"><i class="fa fa-tag"></i>0 Creative</a></li>
<li><a href="#"><i class="fa fa-heart"></i>32 Love</a></li>
</ul>
</div>
_
###**VIEWS.PY**###
class IndexView(generic.ListView):
template_name = 'web_serv/index.html'
context_object_name = 'post_list'
paginate_by = 10
def get_queryset(self):
queryset = Post.objects.all()
if self.request.GET.get('category'):
queryset = queryset.filter(category=self.request.GET.get('category', ''))
return queryset
def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
context['category_list'] = Category.objects.all()
return context
_
#models.py#
class Post(VoteModel, models.Model):
title = models.CharField(max_length=200)
author = models.CharField(max_length=40)
category = models.ForeignKey(Category)
picture = ImageWithThumbsField(sizes=((850, 400), (66, 66)))
content = models.TextField()
created_date = models.DateTimeField(default=timezone.now)
class Meta:
ordering = ['-created_date']
def __str__(self):
return self.title + ' - ' + str(self.created_date.date())
Any suggestions are welcome :)