mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-06 18:38:31 +02:00
Refactor packages
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
from django import forms
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.db import models
|
||||
|
||||
|
||||
# Create your models here.
|
||||
class Bookmark(models.Model):
|
||||
url = models.URLField()
|
||||
title = models.CharField(max_length=512)
|
||||
@@ -25,3 +25,21 @@ class Bookmark(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return self.resolved_title + ' (' + self.url[:30] + '...)'
|
||||
|
||||
|
||||
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