diff --git a/vocabs/api_views.py b/vocabs/api_views.py index 9e3be89..a2f90a6 100644 --- a/vocabs/api_views.py +++ b/vocabs/api_views.py @@ -3,8 +3,16 @@ from rest_framework_guardian import filters from django_filters.rest_framework import DjangoFilterBackend -from .models import * -from .serializers import * +from .models import ( + SkosConceptScheme, + SkosCollection, + SkosConcept +) +from .serializers import ( + SkosCollectionSerializer, + SkosConceptSchemeSerializer, + SkosConceptSerializer +) from rest_framework.settings import api_settings from rest_framework.permissions import DjangoObjectPermissions diff --git a/vocabs/dal_views.py b/vocabs/dal_views.py index 832ad50..ca61771 100644 --- a/vocabs/dal_views.py +++ b/vocabs/dal_views.py @@ -1,10 +1,12 @@ +import requests +import json + from dal import autocomplete from .models import SkosConcept, SkosConceptScheme, SkosCollection from guardian.shortcuts import get_objects_for_user from django.contrib.auth.models import User from mptt.settings import DEFAULT_LEVEL_INDICATOR -import requests, json -from .endpoints import * +from .endpoints import ENDPOINT, DbpediaAC ################ Global autocomplete for external concepts ################ @@ -33,7 +35,6 @@ def global_autocomplete(request, endpoint): class ExternalLinkAC(autocomplete.Select2ListView): def get_list(self): - choices = [] endpoint = self.forwarded.get('endpoint', None) global_ac = global_autocomplete(self.request, endpoint=endpoint) return global_ac diff --git a/vocabs/tables.py b/vocabs/tables.py index 00121f5..b6f274f 100644 --- a/vocabs/tables.py +++ b/vocabs/tables.py @@ -1,6 +1,10 @@ import django_tables2 as tables from django_tables2.utils import A -from vocabs.models import * +from vocabs.models import ( + SkosConcept, + SkosCollection, + SkosConceptScheme +) class SkosConceptSchemeTable(tables.Table): diff --git a/webpage/management/commands/delete_migrations.py b/webpage/management/commands/delete_migrations.py index 9523a06..eea0515 100644 --- a/webpage/management/commands/delete_migrations.py +++ b/webpage/management/commands/delete_migrations.py @@ -1,6 +1,6 @@ import os from django.conf import settings -from django.core.management.base import BaseCommand, CommandError +from django.core.management.base import BaseCommand cwd = settings.BASE_DIR diff --git a/webpage/templatetags/browsing_extras.py b/webpage/templatetags/browsing_extras.py index 49c6eea..a742c34 100644 --- a/webpage/templatetags/browsing_extras.py +++ b/webpage/templatetags/browsing_extras.py @@ -21,7 +21,7 @@ def nav_menu(app=None): item = { 'name': modelname.title(), } - except Exception as e: + except Exception as e: # noqa F841 item = { 'name': None } @@ -39,7 +39,7 @@ def class_definition(context): try: values['class_name'] = context['class_name'] values['docstring'] = context['docstring'] - except Exception as e: + except Exception as e: # noqa F841 pass return values @@ -48,5 +48,5 @@ def class_definition(context): def column_selector(context): try: return {'columns': context['togglable_colums']} - except Exception as e: + except Exception as e: # noqa F841 return {'columns': None} diff --git a/webpage/templatetags/webpage_extras.py b/webpage/templatetags/webpage_extras.py index 11042a3..24be55a 100644 --- a/webpage/templatetags/webpage_extras.py +++ b/webpage/templatetags/webpage_extras.py @@ -18,7 +18,7 @@ def get_verbose_name(instance, field_name): """ try: label = instance._meta.get_field(field_name).verbose_name - except Exception as e: + except Exception as e: # noqa F841 label = None if label: return "{}".format(label) @@ -35,7 +35,7 @@ def get_help_text(instance, field_name): """ try: label = instance._meta.get_field(field_name).help_text - except Exception as e: + except Exception as e: # noqa F841 label = None if label: return "{}".format(label) diff --git a/webpage/utils.py b/webpage/utils.py index 97183d3..54028b3 100644 --- a/webpage/utils.py +++ b/webpage/utils.py @@ -1,7 +1,7 @@ import django_filters from django.views.generic.edit import CreateView, UpdateView from crispy_forms.helper import FormHelper -from crispy_forms.layout import Submit, Layout, Fieldset, Div, MultiField, HTML +from crispy_forms.layout import Submit from django_tables2 import SingleTableView, RequestConfig diff --git a/webpage/views.py b/webpage/views.py index d63bb59..173a854 100644 --- a/webpage/views.py +++ b/webpage/views.py @@ -1,14 +1,19 @@ +import requests from django.conf import settings from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect, JsonResponse -from django.template import RequestContext, loader +from django.template import loader from django.views.generic import TemplateView, DetailView from django.contrib.auth import authenticate, login, logout, get_user_model from .forms import form_user_login from reversion.models import Version from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator -from vocabs.models import * +from vocabs.models import ( + SkosCollection, + SkosConcept, + SkosConceptScheme +) from .metadata import PROJECT_METADATA as PM from copy import deepcopy @@ -30,7 +35,6 @@ class ImprintView(TemplateView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - imprint_url = get_imprint_url() r = requests.get(get_imprint_url()) if r.status_code == 200: @@ -56,7 +60,7 @@ def get_template_names(self): try: loader.select_template([template_name]) template_name = "webpage/{}.html".format(self.kwargs.get("template", 'index')) - except: + except Exception as e: # noqa F841 template_name = "webpage/index.html" return [template_name] diff --git a/webpage/webpage_content_processors.py b/webpage/webpage_content_processors.py index 59578bd..c1d3850 100644 --- a/webpage/webpage_content_processors.py +++ b/webpage/webpage_content_processors.py @@ -16,5 +16,5 @@ def get_db_name(request): try: db_name = settings.DATABASES['default']['NAME'] return {'DB_NAME': db_name} - except Exception as e: + except Exception as e: # noqa F841 return {}