mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-08 19:28:29 +02:00
Implement add bookmark route
This commit is contained in:
21
bookmarks/services/bookmarks.py
Normal file
21
bookmarks/services/bookmarks.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils import timezone
|
||||
|
||||
from bookmarks.models import Bookmark
|
||||
|
||||
|
||||
def create_bookmark(bookmark: Bookmark, current_user: User):
|
||||
# Update website info
|
||||
_update_website_metadata(bookmark)
|
||||
# Set currently logged in user as owner
|
||||
bookmark.owner = current_user
|
||||
# Set dates
|
||||
bookmark.date_added = timezone.now()
|
||||
bookmark.save()
|
||||
|
||||
|
||||
def _update_website_metadata(bookmark: Bookmark):
|
||||
# TODO: Load website metadata
|
||||
bookmark.website_title = 'Title from website'
|
||||
bookmark.website_description = 'Description from website'
|
||||
pass
|
Reference in New Issue
Block a user