added bookmarklet model and api

This commit is contained in:
smilerz
2021-03-26 14:47:24 -05:00
parent f80c44bca3
commit 9a62b6e4e7
6 changed files with 74 additions and 15 deletions

View File

@ -14,7 +14,8 @@ from cookbook.models import (Comment, CookLog, Food, Ingredient, Keyword,
RecipeBook, RecipeBookEntry, RecipeImport,
ShareLink, ShoppingList, ShoppingListEntry,
ShoppingListRecipe, Step, Storage, Sync, SyncLog,
Unit, UserPreference, ViewLog, SupermarketCategory, Supermarket, SupermarketCategoryRelation, ImportLog)
Unit, UserPreference, ViewLog, SupermarketCategory,
Supermarket, SupermarketCategoryRelation, ImportLog, BookmarkletImport)
from cookbook.templatetags.custom_tags import markdown
@ -466,6 +467,17 @@ class ImportLogSerializer(serializers.ModelSerializer):
read_only_fields = ('created_by',)
class BookmarkletImportSerializer(serializers.ModelSerializer):
def create(self, validated_data):
validated_data['created_by'] = self.context['request'].user
validated_data['space'] = self.context['request'].space
return super().create(validated_data)
class Meta:
model = BookmarkletImport
fields = ('id', 'url', 'html', 'created_by', 'created_at')
read_only_fields = ('created_by',)
# Export/Import Serializers
class KeywordExportSerializer(KeywordSerializer):