Skip to content

Commit

Permalink
Merge pull request #95 from arthur-schnitzler/main
Browse files Browse the repository at this point in the history
code updates
  • Loading branch information
csae8092 authored Oct 11, 2024
2 parents cfab1b5 + 16d45f8 commit 6dcf4f1
Show file tree
Hide file tree
Showing 24 changed files with 2,152 additions and 409 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,5 @@ node_modules/
featureCodes_en.csv
featureCodes_en.tsv
listperson.xml
schubert_pmb.csv
brahms_pmb.csv
17 changes: 0 additions & 17 deletions apis_core/apis_relations/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,3 @@
"img_url",
"img_last_checked",
]


CRUD_COLUMN = tables.TemplateColumn(
"""
<a href="{{ record.get_edit_url }}">
<i class="bi bi-pencil-square p-1 fs-5" title="Verbindung bearbeiten" aria-hidden="true">
<span class="visually-hidden">Verbindung bearbeiten</span>
</i>
</a>
<a href="{{ record.get_copy_url }}">
<i class="bi bi-clipboard p-1 fs-5"></i>
</a>
<i class="bi bi-trash p-1 fs-5"></i>
""",
verbose_name="Ändern, Kopieren oder Löschen",
orderable=False,
)
59 changes: 59 additions & 0 deletions apis_core/apis_relations/event_event_relation_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator

from browsing.browsing_utils import GenericListView, BaseCreateView, BaseUpdateView

from apis_core.apis_vocabularies.models import EventEventRelation
from apis_core.apis_relations.models import EventEvent
from apis_core.apis_relations.config import FIELDS_TO_EXCLUDE
from apis_core.apis_relations.utils import (
generate_relation_form,
generate_relation_filter_formhelper,
generate_relation_filter,
generate_relation_table,
)


class EventEventCreate(BaseCreateView):

model = EventEvent
form_class = generate_relation_form(EventEvent)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(EventEventCreate, self).dispatch(*args, **kwargs)


class EventEventUpdate(BaseUpdateView):

model = EventEvent
form_class = generate_relation_form(EventEvent)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(EventEventUpdate, self).dispatch(*args, **kwargs)


class EventEventListView(GenericListView):
model = EventEvent
filter_class = generate_relation_filter(EventEvent, EventEventRelation)
formhelper_class = generate_relation_filter_formhelper()
table_class = generate_relation_table(EventEvent)
init_columns = [
"start_date_written",
"end_date_written",
"source",
"relation_type",
"target",
"crud",
]
verbose_name = "Ereignisse und Ereignisse"
exclude_columns = FIELDS_TO_EXCLUDE
enable_merge = False
template_name = "apis_relations/list_view.html"
59 changes: 59 additions & 0 deletions apis_core/apis_relations/event_work_relation_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator

from browsing.browsing_utils import GenericListView, BaseCreateView, BaseUpdateView

from apis_core.apis_vocabularies.models import EventWorkRelation
from apis_core.apis_relations.models import EventWork
from apis_core.apis_relations.config import FIELDS_TO_EXCLUDE
from apis_core.apis_relations.utils import (
generate_relation_form,
generate_relation_filter_formhelper,
generate_relation_filter,
generate_relation_table,
)


class EventWorkCreate(BaseCreateView):

model = EventWork
form_class = generate_relation_form(EventWork)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(EventWorkCreate, self).dispatch(*args, **kwargs)


class EventWorkUpdate(BaseUpdateView):

model = EventWork
form_class = generate_relation_form(EventWork)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(EventWorkUpdate, self).dispatch(*args, **kwargs)


class EventWorkListView(GenericListView):
model = EventWork
filter_class = generate_relation_filter(EventWork, EventWorkRelation)
formhelper_class = generate_relation_filter_formhelper()
table_class = generate_relation_table(EventWork)
init_columns = [
"start_date_written",
"end_date_written",
"source",
"relation_type",
"target",
"crud",
]
verbose_name = "Ereignisse und Werke"
exclude_columns = FIELDS_TO_EXCLUDE
enable_merge = False
template_name = "apis_relations/list_view.html"
59 changes: 59 additions & 0 deletions apis_core/apis_relations/institution_event_relation_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator

from browsing.browsing_utils import GenericListView, BaseCreateView, BaseUpdateView

from apis_core.apis_vocabularies.models import InstitutionEventRelation
from apis_core.apis_relations.models import InstitutionEvent
from apis_core.apis_relations.config import FIELDS_TO_EXCLUDE
from apis_core.apis_relations.utils import (
generate_relation_form,
generate_relation_filter_formhelper,
generate_relation_filter,
generate_relation_table,
)


class InstitutionEventCreate(BaseCreateView):

model = InstitutionEvent
form_class = generate_relation_form(InstitutionEvent)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(InstitutionEventCreate, self).dispatch(*args, **kwargs)


class InstitutionEventUpdate(BaseUpdateView):

model = InstitutionEvent
form_class = generate_relation_form(InstitutionEvent)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(InstitutionEventUpdate, self).dispatch(*args, **kwargs)


class InstitutionEventListView(GenericListView):
model = InstitutionEvent
filter_class = generate_relation_filter(InstitutionEvent, InstitutionEventRelation)
formhelper_class = generate_relation_filter_formhelper()
table_class = generate_relation_table(InstitutionEvent)
init_columns = [
"start_date_written",
"end_date_written",
"source",
"relation_type",
"target",
"crud",
]
verbose_name = "Institutionen und Ereignisse"
exclude_columns = FIELDS_TO_EXCLUDE
enable_merge = False
template_name = "apis_relations/list_view.html"
61 changes: 61 additions & 0 deletions apis_core/apis_relations/institution_institution_relation_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator

from browsing.browsing_utils import GenericListView, BaseCreateView, BaseUpdateView

from apis_core.apis_vocabularies.models import InstitutionInstitutionRelation
from apis_core.apis_relations.models import InstitutionInstitution
from apis_core.apis_relations.config import FIELDS_TO_EXCLUDE
from apis_core.apis_relations.utils import (
generate_relation_form,
generate_relation_filter_formhelper,
generate_relation_filter,
generate_relation_table,
)


class InstitutionInstitutionCreate(BaseCreateView):

model = InstitutionInstitution
form_class = generate_relation_form(InstitutionInstitution)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(InstitutionInstitutionCreate, self).dispatch(*args, **kwargs)


class InstitutionInstitutionUpdate(BaseUpdateView):

model = InstitutionInstitution
form_class = generate_relation_form(InstitutionInstitution)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(InstitutionInstitutionUpdate, self).dispatch(*args, **kwargs)


class InstitutionInstitutionListView(GenericListView):
model = InstitutionInstitution
filter_class = generate_relation_filter(
InstitutionInstitution, InstitutionInstitutionRelation
)
formhelper_class = generate_relation_filter_formhelper()
table_class = generate_relation_table(InstitutionInstitution)
init_columns = [
"start_date_written",
"end_date_written",
"source",
"relation_type",
"target",
"crud",
]
verbose_name = "Institutionen und Institutionen"
exclude_columns = FIELDS_TO_EXCLUDE
enable_merge = False
template_name = "apis_relations/list_view.html"
59 changes: 59 additions & 0 deletions apis_core/apis_relations/institution_place_relation_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator

from browsing.browsing_utils import GenericListView, BaseCreateView, BaseUpdateView

from apis_core.apis_vocabularies.models import InstitutionPlaceRelation
from apis_core.apis_relations.models import InstitutionPlace
from apis_core.apis_relations.config import FIELDS_TO_EXCLUDE
from apis_core.apis_relations.utils import (
generate_relation_form,
generate_relation_filter_formhelper,
generate_relation_filter,
generate_relation_table,
)


class InstitutionPlaceCreate(BaseCreateView):

model = InstitutionPlace
form_class = generate_relation_form(InstitutionPlace)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(InstitutionPlaceCreate, self).dispatch(*args, **kwargs)


class InstitutionPlaceUpdate(BaseUpdateView):

model = InstitutionPlace
form_class = generate_relation_form(InstitutionPlace)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(InstitutionPlaceUpdate, self).dispatch(*args, **kwargs)


class InstitutionPlaceListView(GenericListView):
model = InstitutionPlace
filter_class = generate_relation_filter(InstitutionPlace, InstitutionPlaceRelation)
formhelper_class = generate_relation_filter_formhelper()
table_class = generate_relation_table(InstitutionPlace)
init_columns = [
"start_date_written",
"end_date_written",
"source",
"relation_type",
"target",
"crud",
]
verbose_name = "Institutionen und Orte"
exclude_columns = FIELDS_TO_EXCLUDE
enable_merge = False
template_name = "apis_relations/list_view.html"
59 changes: 59 additions & 0 deletions apis_core/apis_relations/institution_work_relation_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator

from browsing.browsing_utils import GenericListView, BaseCreateView, BaseUpdateView

from apis_core.apis_vocabularies.models import InstitutionWorkRelation
from apis_core.apis_relations.models import InstitutionWork
from apis_core.apis_relations.config import FIELDS_TO_EXCLUDE
from apis_core.apis_relations.utils import (
generate_relation_form,
generate_relation_filter_formhelper,
generate_relation_filter,
generate_relation_table,
)


class InstitutionWorkCreate(BaseCreateView):

model = InstitutionWork
form_class = generate_relation_form(InstitutionWork)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(InstitutionWorkCreate, self).dispatch(*args, **kwargs)


class InstitutionWorkUpdate(BaseUpdateView):

model = InstitutionWork
form_class = generate_relation_form(InstitutionWork)

def get_success_url(self):
return self.object.get_object_list_view()

@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(InstitutionWorkUpdate, self).dispatch(*args, **kwargs)


class InstitutionWorkListView(GenericListView):
model = InstitutionWork
filter_class = generate_relation_filter(InstitutionWork, InstitutionWorkRelation)
formhelper_class = generate_relation_filter_formhelper()
table_class = generate_relation_table(InstitutionWork)
init_columns = [
"start_date_written",
"end_date_written",
"source",
"relation_type",
"target",
"crud",
]
verbose_name = "Institutionen und Werke"
exclude_columns = FIELDS_TO_EXCLUDE
enable_merge = False
template_name = "apis_relations/list_view.html"
Loading

0 comments on commit 6dcf4f1

Please sign in to comment.