Skip to content

Commit

Permalink
remove legacy junk that regarding now fully replaced relations tables…
Browse files Browse the repository at this point in the history
… and forms
  • Loading branch information
SteffRhes committed Mar 10, 2023
1 parent 10548ec commit 0c3bfec
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 1,237 deletions.
2 changes: 0 additions & 2 deletions apis_core/apis_entities/detail_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from apis_core.apis_labels.models import Label
from apis_core.apis_metainfo.models import Uri
from apis_core.apis_relations.tables import (
get_generic_relations_table,
get_generic_triple_table,
LabelTableBase,
render_triple_table,
render_reification_table,
Expand Down
7 changes: 1 addition & 6 deletions apis_core/apis_entities/edit_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@
from apis_core.apis_labels.models import Label
from apis_core.apis_metainfo.models import Uri
from apis_core.apis_relations.models import Triple, TempTriple
from apis_core.apis_relations.tables import (
get_generic_relations_table,
get_generic_triple_table,
LabelTableEdit,
render_reification_table,
)
from apis_core.apis_relations.tables import LabelTableEdit, render_reification_table
from apis_core.apis_relations.forms import (
render_reification_form_and_table,
render_triple_form,
Expand Down
13 changes: 0 additions & 13 deletions apis_core/apis_relations/forms2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,12 @@
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.urls import reverse

# import autocomplete_light.shortcuts as al
from django.utils.translation import ugettext_lazy as _
from apis_core.apis_relations.models import TempTriple, Property
from apis_core.apis_entities.fields import ListSelect2

# from apis_core.apis_entities.models import AbstractEntity
# from dal.autocomplete import ListSelect2
from apis_core.apis_entities.models import TempEntityClass
from apis_core.apis_metainfo.models import Text, Uri

# from apis_core.apis_relations.models import AbstractRelation
from apis_core.helper_functions import DateParser
from apis_core.helper_functions.RDFParser import RDFParser, APIS_RDF_URI_SETTINGS
from .tables import get_generic_relations_table, get_generic_triple_table
from apis_core.apis_entities.autocomplete3 import (
PropertyAutocomplete,
GenericEntitiesAutocomplete,
)


if "apis_highlighter" in settings.INSTALLED_APPS:
Expand Down
54 changes: 1 addition & 53 deletions apis_core/apis_relations/rel_views.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,11 @@
from django.conf import settings
from django.views.generic.detail import DetailView
from django_tables2 import RequestConfig

from apis_core.apis_entities.views import GenericListViewNew

# from apis_core.apis_relations.models import AbstractRelation
from apis_core.apis_relations.models import Triple, Property
from .rel_filters import get_generic_relation_filter, TripleFilter, PropertyFilter
from .tables import get_generic_relation_listview_table, TripleTable_OLD, PropertyTable


class GenericRelationView(GenericListViewNew):

context_filter_name = "filter"
paginate_by = 25
template_name = getattr(
settings, "APIS_LIST_VIEW_TEMPLATE", "apis_entities/generic_list.html"
)
login_url = "/accounts/login/"

def get_queryset(self, **kwargs):
self.entity = self.kwargs.get("entity")
# qs = AbstractRelation.get_relation_class_of_name(self.entity).objects.all()
qs = None
# Note: the column by which to sort a table by default can also be defined
# via a table's order_by field, which will override whatever value order_field
# is set to, but Django needs order_field to be set to *something* so as not
# to complain about the queryset missing ordering ("unordered object_list")
order_field = "id"

# self.filter = get_generic_relation_filter(
# self.entity.title())(self.request.GET, queryset=qs)

if self.entity == "property":
self.filter = PropertyFilter(self.request.GET, queryset=qs)
order_field = "subj_class"
else:
self.filter = TripleFilter(self.request.GET, queryset=qs)

self.filter.form.helper = self.formhelper_class()
if callable(getattr(self.filter.qs, "filter_for_user", None)):
return self.filter.qs.filter_for_user().distinct().order_by(order_field)
else:
return self.filter.qs.distinct().order_by(order_field)

def get_table(self, **kwargs):
# relation_name = self.kwargs["entity"].lower()
# self.table_class = get_generic_relation_listview_table(relation_name=relation_name)
if self.entity == "property":
self.table_class = PropertyTable
else:
self.table_class = TripleTable_OLD
table = super(GenericListViewNew, self).get_table()
RequestConfig(
self.request, paginate={"page": 1, "per_page": self.paginate_by}
).configure(table)
return table


# TODO RDF: Check if this should be removed or adapted
class GenericRelationDetailView(DetailView):

template_name = getattr(
Expand Down
Loading

0 comments on commit 0c3bfec

Please sign in to comment.