linkding/bookmarks/services/bookmarks.py

22 lines
607 B
Python
Raw Normal View History

2019-06-28 17:37:41 +00:00
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