linkding/bookmarks/forms/bookmark_form.py
2019-06-29 01:00:52 +02:00

21 lines
756 B
Python

from django import forms
from bookmarks.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']