commit 707d862e01a7497a1f22879d314b865a35e0e85b
Author: smilerz <smilerz@gmail.com>
Date: Wed Apr 14 10:35:00 2021 -0500
works now
commit 3942a445ed4f2ccec57de25eacd86ea4e4dd6bdb
Author: smilerz <smilerz@gmail.com>
Date: Wed Apr 14 10:25:24 2021 -0500
updated serializer and api
commit 10dc746eb175c7f805a8a8ffa7ce49977a7ce97e
Author: smilerz <smilerz@gmail.com>
Date: Wed Apr 14 10:20:19 2021 -0500
fixed bookmarklet
commit 9779104902d3be0258c95cd2eeebcba0d5d48892
Merge: bb8262c 0cb3928
Author: smilerz <smilerz@gmail.com>
Date: Wed Apr 14 09:56:27 2021 -0500
Merge branch 'bookmarklet' into json_import
commit 0cb39284bb835ffc6cfee3e4306aadc4a64a25be
Author: smilerz <smilerz@gmail.com>
Date: Wed Apr 14 09:42:53 2021 -0500
retrieve bookmarklet ID from get
commit e89e0218de684d40b2e2bfb6ba833891206c828e
Author: smilerz <smilerz@gmail.com>
Date: Wed Apr 14 09:29:33 2021 -0500
Revert "fixed broken tab"
This reverts commit ca0a1aede3cc6cb3912bc1fe30c0aa22e3f481a6.
commit bb8262ccabb93c56fbc18c407d5a0653b8b3ca79
Merge: b1e73aa 35a7f62
Author: smilerz <smilerz@gmail.com>
Date: Sun Apr 11 20:35:57 2021 -0500
Merge branch 'main_fork' into json_import
238 lines
5.4 KiB
Python
238 lines
5.4 KiB
Python
from django.contrib import admin
|
|
from django.contrib.auth.admin import UserAdmin
|
|
from django.contrib.auth.models import User, Group
|
|
|
|
from .models import (Comment, CookLog, Food, Ingredient, InviteLink, Keyword,
|
|
MealPlan, MealType, NutritionInformation, Recipe,
|
|
RecipeBook, RecipeBookEntry, RecipeImport, ShareLink,
|
|
ShoppingList, ShoppingListEntry, ShoppingListRecipe,
|
|
Space, Step, Storage, Sync, SyncLog, Unit, UserPreference,
|
|
ViewLog, Supermarket, SupermarketCategory, SupermarketCategoryRelation,
|
|
ImportLog, TelegramBot, BookmarkletImport)
|
|
|
|
|
|
class CustomUserAdmin(UserAdmin):
|
|
def has_add_permission(self, request, obj=None):
|
|
return False
|
|
|
|
|
|
admin.site.unregister(User)
|
|
admin.site.register(User, CustomUserAdmin)
|
|
|
|
admin.site.unregister(Group)
|
|
|
|
|
|
class SpaceAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'created_by', 'message')
|
|
|
|
|
|
admin.site.register(Space, SpaceAdmin)
|
|
|
|
|
|
class UserPreferenceAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'space', 'theme', 'nav_color', 'default_page', 'search_style',)
|
|
|
|
@staticmethod
|
|
def name(obj):
|
|
return obj.user.get_user_name()
|
|
|
|
|
|
admin.site.register(UserPreference, UserPreferenceAdmin)
|
|
|
|
|
|
class StorageAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'method')
|
|
|
|
|
|
admin.site.register(Storage, StorageAdmin)
|
|
|
|
|
|
class SyncAdmin(admin.ModelAdmin):
|
|
list_display = ('storage', 'path', 'active', 'last_checked')
|
|
|
|
|
|
admin.site.register(Sync, SyncAdmin)
|
|
|
|
|
|
class SupermarketCategoryInline(admin.TabularInline):
|
|
model = SupermarketCategoryRelation
|
|
|
|
|
|
class SupermarketAdmin(admin.ModelAdmin):
|
|
inlines = (SupermarketCategoryInline,)
|
|
|
|
|
|
admin.site.register(Supermarket, SupermarketAdmin)
|
|
admin.site.register(SupermarketCategory)
|
|
|
|
|
|
class SyncLogAdmin(admin.ModelAdmin):
|
|
list_display = ('sync', 'status', 'msg', 'created_at')
|
|
|
|
|
|
admin.site.register(SyncLog, SyncLogAdmin)
|
|
|
|
admin.site.register(Keyword)
|
|
|
|
|
|
class StepAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'type', 'order')
|
|
|
|
|
|
admin.site.register(Step, StepAdmin)
|
|
|
|
|
|
class RecipeAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'internal', 'created_by', 'storage')
|
|
|
|
@staticmethod
|
|
def created_by(obj):
|
|
return obj.created_by.get_user_name()
|
|
|
|
|
|
admin.site.register(Recipe, RecipeAdmin)
|
|
|
|
admin.site.register(Unit)
|
|
admin.site.register(Food)
|
|
|
|
|
|
class IngredientAdmin(admin.ModelAdmin):
|
|
list_display = ('food', 'amount', 'unit')
|
|
|
|
|
|
admin.site.register(Ingredient, IngredientAdmin)
|
|
|
|
|
|
class CommentAdmin(admin.ModelAdmin):
|
|
list_display = ('recipe', 'name', 'created_at')
|
|
|
|
@staticmethod
|
|
def name(obj):
|
|
return obj.created_by.get_user_name()
|
|
|
|
|
|
admin.site.register(Comment, CommentAdmin)
|
|
|
|
|
|
class RecipeImportAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'storage', 'file_path')
|
|
|
|
|
|
admin.site.register(RecipeImport, RecipeImportAdmin)
|
|
|
|
|
|
class RecipeBookAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'user_name')
|
|
|
|
@staticmethod
|
|
def user_name(obj):
|
|
return obj.created_by.get_user_name()
|
|
|
|
|
|
admin.site.register(RecipeBook, RecipeBookAdmin)
|
|
|
|
|
|
class RecipeBookEntryAdmin(admin.ModelAdmin):
|
|
list_display = ('book', 'recipe')
|
|
|
|
|
|
admin.site.register(RecipeBookEntry, RecipeBookEntryAdmin)
|
|
|
|
|
|
class MealPlanAdmin(admin.ModelAdmin):
|
|
list_display = ('user', 'recipe', 'meal_type', 'date')
|
|
|
|
@staticmethod
|
|
def user(obj):
|
|
return obj.created_by.get_user_name()
|
|
|
|
|
|
admin.site.register(MealPlan, MealPlanAdmin)
|
|
|
|
|
|
class MealTypeAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'created_by', 'order')
|
|
|
|
|
|
admin.site.register(MealType, MealTypeAdmin)
|
|
|
|
|
|
class ViewLogAdmin(admin.ModelAdmin):
|
|
list_display = ('recipe', 'created_by', 'created_at')
|
|
|
|
|
|
admin.site.register(ViewLog, ViewLogAdmin)
|
|
|
|
|
|
class InviteLinkAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
'username', 'group', 'valid_until',
|
|
'created_by', 'created_at', 'used_by'
|
|
)
|
|
|
|
|
|
admin.site.register(InviteLink, InviteLinkAdmin)
|
|
|
|
|
|
class CookLogAdmin(admin.ModelAdmin):
|
|
list_display = ('recipe', 'created_by', 'created_at', 'rating', 'servings')
|
|
|
|
|
|
admin.site.register(CookLog, CookLogAdmin)
|
|
|
|
|
|
class ShoppingListRecipeAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'recipe', 'servings')
|
|
|
|
|
|
admin.site.register(ShoppingListRecipe, ShoppingListRecipeAdmin)
|
|
|
|
|
|
class ShoppingListEntryAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'food', 'unit', 'list_recipe', 'checked')
|
|
|
|
|
|
admin.site.register(ShoppingListEntry, ShoppingListEntryAdmin)
|
|
|
|
|
|
class ShoppingListAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'created_by', 'created_at')
|
|
|
|
|
|
admin.site.register(ShoppingList, ShoppingListAdmin)
|
|
|
|
|
|
class ShareLinkAdmin(admin.ModelAdmin):
|
|
list_display = ('recipe', 'created_by', 'uuid', 'created_at',)
|
|
|
|
|
|
admin.site.register(ShareLink, ShareLinkAdmin)
|
|
|
|
|
|
class NutritionInformationAdmin(admin.ModelAdmin):
|
|
list_display = ('id',)
|
|
|
|
|
|
admin.site.register(NutritionInformation, NutritionInformationAdmin)
|
|
|
|
|
|
class ImportLogAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'type', 'running', 'created_by', 'created_at',)
|
|
|
|
|
|
admin.site.register(ImportLog, ImportLogAdmin)
|
|
|
|
|
|
class TelegramBotAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'name', 'created_by',)
|
|
|
|
|
|
admin.site.register(TelegramBot, TelegramBotAdmin)
|
|
|
|
|
|
class BookmarkletImportAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'url', 'created_by', 'created_at',)
|
|
|
|
|
|
admin.site.register(BookmarkletImport, BookmarkletImportAdmin)
|