sort views imports
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
from cookbook.views.views import *
|
|
||||||
from cookbook.views.api import *
|
from cookbook.views.api import *
|
||||||
from cookbook.views.data import *
|
from cookbook.views.data import *
|
||||||
from cookbook.views.edit import *
|
|
||||||
from cookbook.views.new import *
|
|
||||||
from cookbook.views.lists import *
|
|
||||||
from cookbook.views.delete import *
|
from cookbook.views.delete import *
|
||||||
|
from cookbook.views.edit import *
|
||||||
|
from cookbook.views.lists import *
|
||||||
|
from cookbook.views.new import *
|
||||||
|
from cookbook.views.views import *
|
||||||
|
@ -4,7 +4,6 @@ import re
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from PIL import Image
|
|
||||||
from annoying.decorators import ajax_request
|
from annoying.decorators import ajax_request
|
||||||
from annoying.functions import get_object_or_None
|
from annoying.functions import get_object_or_None
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
@ -12,28 +11,45 @@ from django.contrib.auth.models import User
|
|||||||
from django.core import management
|
from django.core import management
|
||||||
from django.core.files import File
|
from django.core.files import File
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.http import HttpResponse, FileResponse, JsonResponse
|
from django.http import FileResponse, HttpResponse, JsonResponse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.utils import timezone, dateformat
|
from django.utils import timezone
|
||||||
from django.utils.formats import date_format
|
from django.utils.formats import date_format
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.generic.base import View
|
|
||||||
from icalendar import Calendar, Event
|
from icalendar import Calendar, Event
|
||||||
from rest_framework import viewsets, permissions, decorators
|
from PIL import Image
|
||||||
|
from rest_framework import decorators, permissions, viewsets
|
||||||
from rest_framework.exceptions import APIException
|
from rest_framework.exceptions import APIException
|
||||||
from rest_framework.mixins import RetrieveModelMixin, UpdateModelMixin, ListModelMixin
|
from rest_framework.mixins import (ListModelMixin, RetrieveModelMixin,
|
||||||
from rest_framework.parsers import JSONParser, FileUploadParser, MultiPartParser
|
UpdateModelMixin)
|
||||||
|
from rest_framework.parsers import MultiPartParser
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.viewsets import ViewSetMixin
|
from rest_framework.viewsets import ViewSetMixin
|
||||||
|
|
||||||
from cookbook.helper.permission_helper import group_required, CustomIsOwner, CustomIsAdmin, CustomIsUser, CustomIsGuest, CustomIsShare, CustomIsShared
|
from cookbook.helper.permission_helper import (CustomIsAdmin, CustomIsGuest,
|
||||||
|
CustomIsOwner, CustomIsShare,
|
||||||
|
CustomIsShared, CustomIsUser,
|
||||||
|
group_required)
|
||||||
from cookbook.helper.recipe_url_import import get_from_html
|
from cookbook.helper.recipe_url_import import get_from_html
|
||||||
from cookbook.models import Recipe, Sync, Storage, CookLog, MealPlan, MealType, ViewLog, UserPreference, RecipeBook, Ingredient, Food, Step, Keyword, Unit, SyncLog, ShoppingListRecipe, ShoppingList, ShoppingListEntry
|
from cookbook.models import (CookLog, Food, Ingredient, Keyword, MealPlan,
|
||||||
|
MealType, Recipe, RecipeBook, ShoppingList,
|
||||||
|
ShoppingListEntry, ShoppingListRecipe, Step,
|
||||||
|
Storage, Sync, SyncLog, Unit, UserPreference,
|
||||||
|
ViewLog)
|
||||||
from cookbook.provider.dropbox import Dropbox
|
from cookbook.provider.dropbox import Dropbox
|
||||||
from cookbook.provider.nextcloud import Nextcloud
|
from cookbook.provider.nextcloud import Nextcloud
|
||||||
from cookbook.serializer import MealPlanSerializer, MealTypeSerializer, RecipeSerializer, ViewLogSerializer, UserNameSerializer, UserPreferenceSerializer, RecipeBookSerializer, IngredientSerializer, FoodSerializer, StepSerializer, \
|
from cookbook.serializer import (FoodSerializer, IngredientSerializer,
|
||||||
KeywordSerializer, RecipeImageSerializer, StorageSerializer, SyncSerializer, SyncLogSerializer, UnitSerializer, ShoppingListSerializer, ShoppingListRecipeSerializer, ShoppingListEntrySerializer, ShoppingListEntryCheckedSerializer, \
|
KeywordSerializer, MealPlanSerializer,
|
||||||
ShoppingListAutoSyncSerializer
|
MealTypeSerializer, RecipeBookSerializer,
|
||||||
|
RecipeImageSerializer, RecipeSerializer,
|
||||||
|
ShoppingListAutoSyncSerializer,
|
||||||
|
ShoppingListEntrySerializer,
|
||||||
|
ShoppingListRecipeSerializer,
|
||||||
|
ShoppingListSerializer, StepSerializer,
|
||||||
|
StorageSerializer, SyncLogSerializer,
|
||||||
|
SyncSerializer, UnitSerializer,
|
||||||
|
UserNameSerializer, UserPreferenceSerializer,
|
||||||
|
ViewLogSerializer)
|
||||||
|
|
||||||
|
|
||||||
class UserNameViewSet(viewsets.ReadOnlyModelViewSet):
|
class UserNameViewSet(viewsets.ReadOnlyModelViewSet):
|
||||||
|
@ -3,19 +3,20 @@ from datetime import datetime
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from PIL import Image, UnidentifiedImageError
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.files import File
|
from django.core.files import File
|
||||||
from django.db.transaction import atomic
|
from django.db.transaction import atomic
|
||||||
from django.utils.translation import gettext as _
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from django.http import HttpResponseRedirect, HttpResponse
|
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
from django.utils.translation import gettext as _
|
||||||
from django.utils.translation import ngettext
|
from django.utils.translation import ngettext
|
||||||
from django_tables2 import RequestConfig
|
from django_tables2 import RequestConfig
|
||||||
|
from PIL import Image, UnidentifiedImageError
|
||||||
|
|
||||||
from cookbook.forms import SyncForm, BatchEditForm
|
from cookbook.forms import BatchEditForm, SyncForm
|
||||||
from cookbook.helper.permission_helper import group_required, has_group_permission
|
from cookbook.helper.permission_helper import (group_required,
|
||||||
|
has_group_permission)
|
||||||
from cookbook.models import *
|
from cookbook.models import *
|
||||||
from cookbook.tables import SyncTable
|
from cookbook.tables import SyncTable
|
||||||
|
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
||||||
from django.db.models import ProtectedError
|
from django.db.models import ProtectedError
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.urls import reverse_lazy, reverse
|
from django.urls import reverse, reverse_lazy
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.generic import DeleteView
|
from django.views.generic import DeleteView
|
||||||
|
|
||||||
from cookbook.helper.permission_helper import group_required, GroupRequiredMixin, OwnerRequiredMixin
|
from cookbook.helper.permission_helper import (GroupRequiredMixin,
|
||||||
from cookbook.models import Recipe, Sync, Keyword, RecipeImport, Storage, Comment, RecipeBook, \
|
OwnerRequiredMixin,
|
||||||
RecipeBookEntry, MealPlan, Food, InviteLink
|
group_required)
|
||||||
|
from cookbook.models import (Comment, InviteLink, Keyword, MealPlan, Recipe,
|
||||||
|
RecipeBook, RecipeBookEntry, RecipeImport,
|
||||||
|
Storage, Sync)
|
||||||
from cookbook.provider.dropbox import Dropbox
|
from cookbook.provider.dropbox import Dropbox
|
||||||
from cookbook.provider.nextcloud import Nextcloud
|
from cookbook.provider.nextcloud import Nextcloud
|
||||||
|
|
||||||
|
@ -7,12 +7,16 @@ from django.urls import reverse
|
|||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.generic import UpdateView
|
from django.views.generic import UpdateView
|
||||||
|
|
||||||
from cookbook.forms import ExternalRecipeForm, KeywordForm, StorageForm, SyncForm, CommentForm, \
|
from cookbook.forms import (CommentForm, ExternalRecipeForm, FoodForm,
|
||||||
MealPlanForm, UnitMergeForm, RecipeBookForm, FoodForm, FoodMergeForm
|
FoodMergeForm, KeywordForm, MealPlanForm,
|
||||||
from cookbook.helper.permission_helper import OwnerRequiredMixin
|
RecipeBookForm, StorageForm, SyncForm,
|
||||||
from cookbook.helper.permission_helper import group_required, GroupRequiredMixin
|
UnitMergeForm)
|
||||||
from cookbook.models import Recipe, Sync, Keyword, RecipeImport, Storage, Comment, Ingredient, RecipeBook, \
|
from cookbook.helper.permission_helper import (GroupRequiredMixin,
|
||||||
MealPlan, Food, MealType
|
OwnerRequiredMixin,
|
||||||
|
group_required)
|
||||||
|
from cookbook.models import (Comment, Food, Ingredient, Keyword, MealPlan,
|
||||||
|
MealType, Recipe, RecipeBook, RecipeImport,
|
||||||
|
Storage, Sync)
|
||||||
from cookbook.provider.dropbox import Dropbox
|
from cookbook.provider.dropbox import Dropbox
|
||||||
from cookbook.provider.nextcloud import Nextcloud
|
from cookbook.provider.nextcloud import Nextcloud
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ from json import JSONDecodeError
|
|||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.files.base import ContentFile
|
from django.core.files.base import ContentFile
|
||||||
from django.http import HttpResponseRedirect, HttpResponse
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.db.models.functions import Lower
|
from django.db.models.functions import Lower
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
@ -9,8 +8,11 @@ from django_tables2 import RequestConfig
|
|||||||
|
|
||||||
from cookbook.filters import IngredientFilter, ShoppingListFilter
|
from cookbook.filters import IngredientFilter, ShoppingListFilter
|
||||||
from cookbook.helper.permission_helper import group_required
|
from cookbook.helper.permission_helper import group_required
|
||||||
from cookbook.models import Keyword, SyncLog, RecipeImport, Storage, Food, ShoppingList, InviteLink
|
from cookbook.models import (Food, InviteLink, Keyword, RecipeImport,
|
||||||
from cookbook.tables import KeywordTable, ImportLogTable, RecipeImportTable, StorageTable, IngredientTable, ShoppingListTable, InviteLinkTable
|
ShoppingList, Storage, SyncLog)
|
||||||
|
from cookbook.tables import (ImportLogTable, IngredientTable, InviteLinkTable,
|
||||||
|
KeywordTable, RecipeImportTable,
|
||||||
|
ShoppingListTable, StorageTable)
|
||||||
|
|
||||||
|
|
||||||
@group_required('user')
|
@group_required('user')
|
||||||
|
@ -3,15 +3,18 @@ from datetime import datetime
|
|||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render, redirect, get_object_or_404
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
from django.urls import reverse_lazy, reverse
|
from django.urls import reverse, reverse_lazy
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from django.views.generic import CreateView
|
from django.views.generic import CreateView
|
||||||
|
|
||||||
from cookbook.forms import ImportRecipeForm, RecipeImport, KeywordForm, Storage, StorageForm, InternalRecipeForm, \
|
from cookbook.forms import (ImportRecipeForm, InviteLinkForm, KeywordForm,
|
||||||
RecipeBookForm, MealPlanForm, InviteLinkForm
|
MealPlanForm, RecipeBookForm, RecipeImport,
|
||||||
from cookbook.helper.permission_helper import GroupRequiredMixin, group_required
|
Storage, StorageForm)
|
||||||
from cookbook.models import Keyword, Recipe, RecipeBook, MealPlan, ShareLink, MealType, Step, InviteLink
|
from cookbook.helper.permission_helper import (GroupRequiredMixin,
|
||||||
|
group_required)
|
||||||
|
from cookbook.models import (InviteLink, Keyword, MealPlan, MealType, Recipe,
|
||||||
|
RecipeBook, ShareLink, Step)
|
||||||
|
|
||||||
|
|
||||||
class RecipeCreate(GroupRequiredMixin, CreateView):
|
class RecipeCreate(GroupRequiredMixin, CreateView):
|
||||||
|
@ -1,30 +1,28 @@
|
|||||||
import copy
|
|
||||||
import os
|
import os
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth import update_session_auth_hash, authenticate
|
from django.contrib.auth import update_session_auth_hash
|
||||||
from django.contrib.auth.forms import PasswordChangeForm
|
from django.contrib.auth.forms import PasswordChangeForm
|
||||||
from django.contrib.auth.password_validation import validate_password
|
from django.contrib.auth.password_validation import validate_password
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import IntegrityError
|
from django.db import IntegrityError
|
||||||
from django.db.models import Q, Avg
|
from django.db.models import Avg, Q
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import get_object_or_404, render
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
|
||||||
from django_tables2 import RequestConfig
|
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
from django_tables2 import RequestConfig
|
||||||
from django.conf import settings
|
|
||||||
from rest_framework.authtoken.models import Token
|
from rest_framework.authtoken.models import Token
|
||||||
|
|
||||||
from cookbook.filters import RecipeFilter
|
from cookbook.filters import RecipeFilter
|
||||||
from cookbook.forms import *
|
from cookbook.forms import *
|
||||||
from cookbook.helper.permission_helper import group_required, share_link_valid
|
from cookbook.helper.permission_helper import group_required, share_link_valid
|
||||||
from cookbook.tables import RecipeTable, RecipeTableSmall, CookLogTable, ViewLogTable
|
from cookbook.tables import (CookLogTable, RecipeTable, RecipeTableSmall,
|
||||||
|
ViewLogTable)
|
||||||
from recipes.version import *
|
from recipes.version import *
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +127,8 @@ def recipe_view(request, pk, share=None):
|
|||||||
|
|
||||||
return render(request, 'recipe_view.html',
|
return render(request, 'recipe_view.html',
|
||||||
{'recipe': recipe, 'comments': comments, 'comment_form': comment_form,
|
{'recipe': recipe, 'comments': comments, 'comment_form': comment_form,
|
||||||
'bookmark_form': bookmark_form, 'share': share, 'user_servings': user_servings})
|
'bookmark_form': bookmark_form, 'share': share, 'user_servings': user_servings
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
@group_required('user')
|
@group_required('user')
|
||||||
@ -248,7 +247,8 @@ def user_settings(request):
|
|||||||
|
|
||||||
return render(request, 'settings.html',
|
return render(request, 'settings.html',
|
||||||
{'preference_form': preference_form, 'user_name_form': user_name_form, 'password_form': password_form,
|
{'preference_form': preference_form, 'user_name_form': user_name_form, 'password_form': password_form,
|
||||||
'api_token': api_token})
|
'api_token': api_token
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
@group_required('guest')
|
@group_required('guest')
|
||||||
@ -267,7 +267,8 @@ def system(request):
|
|||||||
|
|
||||||
return render(request, 'system.html',
|
return render(request, 'system.html',
|
||||||
{'gunicorn_media': settings.GUNICORN_MEDIA, 'debug': settings.DEBUG, 'postgres': postgres,
|
{'gunicorn_media': settings.GUNICORN_MEDIA, 'debug': settings.DEBUG, 'postgres': postgres,
|
||||||
'version': VERSION_NUMBER, 'ref': BUILD_REF, 'secret_key': secret_key})
|
'version': VERSION_NUMBER, 'ref': BUILD_REF, 'secret_key': secret_key
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
def setup(request):
|
def setup(request):
|
||||||
|
Reference in New Issue
Block a user