mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-08 03:08:29 +02:00
Implement basic bookmark page
This commit is contained in:
31
bookmarks/views.py
Normal file
31
bookmarks/views.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
from django.urls import reverse
|
||||
|
||||
from .models import Bookmark
|
||||
|
||||
|
||||
def index(request):
|
||||
context = {
|
||||
'bookmarks': Bookmark.objects.all()
|
||||
}
|
||||
return render(request, 'bookmarks/index.html', context)
|
||||
|
||||
|
||||
def create(request):
|
||||
return HttpResponse('OK')
|
||||
|
||||
|
||||
def detail(request, bookmark_id):
|
||||
context = {
|
||||
'bookmark': Bookmark.objects.get(bookmark_id)
|
||||
}
|
||||
return render(request, 'bookmarks/detail.html', context)
|
||||
|
||||
|
||||
def remove(request, bookmark_id: int):
|
||||
bookmark = Bookmark.objects.get(pk=bookmark_id)
|
||||
bookmark.delete()
|
||||
return HttpResponseRedirect(reverse('bookmarks:index'))
|
Reference in New Issue
Block a user