Created
December 5, 2013 02:35
-
-
Save mx-moth/7799289 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for user_item in user_items %} | |
<div class="item"> | |
{% include "item.html" with item=user_item.item %} | |
</div> | |
<div class="actions"> | |
<form action="{% url "mark_read" user_item_id=user_item.id %}" method="post"> | |
<button>Mark as read</button> | |
</form> | |
</div> | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def feed(request): | |
user_items = UserItem.objects.filter(user=request.user) | |
return render(request, 'feed.html', {user_items: user_items}) | |
def mark_read(request, user_item_id): | |
user_item = get_object_or_404(UserItem, user=request.user, id=user_item_id) | |
user_item.read = True | |
user_item.save() | |
return redirect(feed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment