From 075e50b911a5fe55c44bda0d8d855154071deecf Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sun, 22 Jun 2025 13:43:34 +0200 Subject: [PATCH] cleanup tables --- cookbook/tables.py | 109 --------------------------------------------- 1 file changed, 109 deletions(-) delete mode 100644 cookbook/tables.py diff --git a/cookbook/tables.py b/cookbook/tables.py deleted file mode 100644 index 3fcec9c32..000000000 --- a/cookbook/tables.py +++ /dev/null @@ -1,109 +0,0 @@ -import django_tables2 as tables -from django.utils.html import format_html -from django.utils.translation import gettext as _ -from django_tables2.utils import A - -from .models import CookLog, InviteLink, RecipeImport, Storage, Sync, SyncLog, ViewLog, ConnectorConfig - - -class StorageTable(tables.Table): - id = tables.LinkColumn('edit_storage', args=[A('id')]) - - class Meta: - model = Storage - template_name = 'generic/table_template.html' - fields = ('id', 'name', 'method') - - -class ConnectorConfigTable(tables.Table): - id = tables.LinkColumn('edit_connector_config', args=[A('id')]) - - class Meta: - model = ConnectorConfig - template_name = 'generic/table_template.html' - fields = ('id', 'name', 'type', 'enabled') - - -class ImportLogTable(tables.Table): - sync_id = tables.LinkColumn('edit_sync', args=[A('sync_id')]) - - @staticmethod - def render_status(value): - if value == 'SUCCESS': - return format_html( - '%s' % value - ) - else: - return format_html( - '%s' % value - ) - - class Meta: - model = SyncLog - template_name = 'generic/table_template.html' - fields = ('status', 'msg', 'sync_id', 'created_at') - - -class SyncTable(tables.Table): - id = tables.LinkColumn('edit_sync', args=[A('id')]) - - @staticmethod - def render_path(value): - return format_html('%s' % value) - - @staticmethod - def render_storage(value): - return format_html( - '%s' % value - ) - - class Meta: - model = Sync - template_name = 'generic/table_template.html' - fields = ('id', 'path', 'storage', 'last_checked') - - -class RecipeImportTable(tables.Table): - id = tables.LinkColumn('new_recipe_import', args=[A('id')]) - delete = tables.TemplateColumn( - "" + _('Delete') + "" # noqa: E501 - ) - - class Meta: - model = RecipeImport - template_name = 'generic/table_template.html' - fields = ('id', 'name', 'file_path') - - -class InviteLinkTable(tables.Table): - link = tables.TemplateColumn( - "" - ) - delete_link = tables.TemplateColumn( - "" + _('Delete') + "", verbose_name=_('Delete') - ) - - class Meta: - model = InviteLink - template_name = 'generic/table_template.html' - fields = ( - 'username', 'group', 'valid_until', - ) - - -class ViewLogTable(tables.Table): - recipe = tables.LinkColumn('view_recipe', args=[A('recipe_id')]) - - class Meta: - model = ViewLog - template_name = 'generic/table_template.html' - fields = ('recipe', 'created_at') - - -class CookLogTable(tables.Table): - recipe = tables.LinkColumn('view_recipe', args=[A('recipe_id')]) - - class Meta: - model = CookLog - template_name = 'generic/table_template.html' - fields = ('recipe', 'rating', 'serving', 'created_at')