Skip to content

Commit

Permalink
closing #36
Browse files Browse the repository at this point in the history
  • Loading branch information
csae8092 committed Jul 19, 2022
1 parent 9d15144 commit 2c752f9
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 18 deletions.
12 changes: 10 additions & 2 deletions vocabs/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions vocabs/dal_views.py
Original file line number Diff line number Diff line change
@@ -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 ################
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion vocabs/tables.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
2 changes: 1 addition & 1 deletion webpage/management/commands/delete_migrations.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions webpage/templatetags/browsing_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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

Expand All @@ -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}
4 changes: 2 additions & 2 deletions webpage/templatetags/webpage_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion webpage/utils.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
12 changes: 8 additions & 4 deletions webpage/views.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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:
Expand All @@ -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]

Expand Down
2 changes: 1 addition & 1 deletion webpage/webpage_content_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

0 comments on commit 2c752f9

Please sign in to comment.