I have an app that display all newsitems having model like:
class NewsItem(models.Model):
url = models.CharField(max_length=500, default="",unique=True)
title = models.CharField(max_length=500, default="")
hacker_news_url = models.CharField(max_length=500, default="")
posted_on = models.DateTimeField(default=datetime.now)
upvote_count = models.IntegerField(default=0)
comment_count = models.IntegerField(default=0)
I had already setup the default django authentication to view this page. The ui has hide button for each post. So the problem is if the logged in user hides the post, it must be hidden for that user only (even after page refresh) without deleting from NewsItem Model/Table. How to do that? Help Please!
This is my views.py:
@login_required(login_url='/accounts/login')
def index(request):
context={'news_items':NewsItem.objects.all().order_by('posted_on')}
return render(request, "hello.html", context)
