mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-13 13:39:27 +02:00
Implement add bookmark route
This commit is contained in:
1
bookmarks/forms/__init__.py
Normal file
1
bookmarks/forms/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .bookmark_form import *
|
20
bookmarks/forms/bookmark_form.py
Normal file
20
bookmarks/forms/bookmark_form.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from django import forms
|
||||
|
||||
from ..models import Bookmark
|
||||
|
||||
auto_fill_placeholder = 'Leave empty to fill from website metadata'
|
||||
|
||||
|
||||
class BookmarkForm(forms.ModelForm):
|
||||
# Use URLField for URL
|
||||
url = forms.URLField()
|
||||
# Do not require title and description in form as we fill these automatically if they are empty
|
||||
title = forms.CharField(max_length=512,
|
||||
required=False,
|
||||
widget=forms.TextInput(attrs={'placeholder': auto_fill_placeholder}))
|
||||
description = forms.CharField(required=False,
|
||||
widget=forms.Textarea(attrs={'placeholder': auto_fill_placeholder}))
|
||||
|
||||
class Meta:
|
||||
model = Bookmark
|
||||
fields = ['url', 'title', 'description']
|
Reference in New Issue
Block a user