-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #224 from arthur-schnitzler/220-createcopyedit-and…
…-delete-views-for-relations 220 createcopyedit and delete views for relations
- Loading branch information
Showing
15 changed files
with
1,269 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
59
apis_core/apis_relations/institution_event_relation_views.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
61
apis_core/apis_relations/institution_institution_relation_views.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
59
apis_core/apis_relations/institution_place_relation_views.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
59
apis_core/apis_relations/institution_work_relation_views.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Oops, something went wrong.