remove unused imports, vairables and commented code

from views, and base cookbook and recipes modules
This commit is contained in:
smilerz
2023-09-13 13:31:53 -05:00
parent 1f0cd58d7d
commit 538fb8b42e
15 changed files with 41 additions and 151 deletions

View File

@@ -10,12 +10,11 @@ from django.utils.translation import gettext as _
from django.utils.translation import ngettext
from django_tables2 import RequestConfig
from oauth2_provider.models import AccessToken
from rest_framework.authtoken.models import Token
from cookbook.forms import BatchEditForm, SyncForm
from cookbook.helper.permission_helper import group_required, has_group_permission, above_space_limit
from cookbook.models import (Comment, Food, Keyword, Recipe, RecipeImport, Sync,
Unit, UserPreference, BookmarkletImport)
from cookbook.helper.permission_helper import (above_space_limit, group_required,
has_group_permission)
from cookbook.models import BookmarkletImport, Recipe, RecipeImport, Sync
from cookbook.tables import SyncTable
from recipes import settings
@@ -119,11 +118,19 @@ def import_url(request):
return HttpResponseRedirect(reverse('index'))
if (api_token := AccessToken.objects.filter(user=request.user, scope='bookmarklet').first()) is None:
api_token = AccessToken.objects.create(user=request.user, scope='bookmarklet', expires=(timezone.now() + timezone.timedelta(days=365*10)), token=f'tda_{str(uuid.uuid4()).replace("-","_")}')
api_token = AccessToken.objects.create(
user=request.user,
scope='bookmarklet',
expires=(
timezone.now() +
timezone.timedelta(
days=365 *
10)),
token=f'tda_{str(uuid.uuid4()).replace("-","_")}')
bookmarklet_import_id = -1
if 'id' in request.GET:
if bookmarklet_import := BookmarkletImport.objects.filter(id=request.GET['id']).first():
bookmarklet_import_id = bookmarklet_import.pk
return render(request, 'url_import.html', {'api_token': api_token, 'bookmarklet_import_id': bookmarklet_import_id})
return render(request, 'url_import.html', {'api_token': api_token, 'bookmarklet_import_id': bookmarklet_import_id})