Skip to content

Commit

Permalink
Merge pull request #165 from acdh-oeaw/core-chore
Browse files Browse the repository at this point in the history
Update core
  • Loading branch information
gythaogg authored Nov 13, 2024
2 parents f39b238 + c5fde16 commit 6fc3f59
Show file tree
Hide file tree
Showing 30 changed files with 999 additions and 1,628 deletions.
49 changes: 4 additions & 45 deletions apis_ontology/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from apis_core.relations.models import Relation
from apis_core.relations.forms import RelationForm
from django import forms
from apis_core.generic.forms import GenericFilterSetForm, GenericModelForm
from django.forms.models import ModelChoiceField
Expand All @@ -15,26 +16,9 @@ class Meta:
}


class TibScholRelationMixinForm(GenericModelForm):
class Meta:
exclude = []
model = Relation

field_order = ["subj", "obj"]

def __init__(
self,
*args,
**kwargs,
):
super().__init__(*args, **kwargs)

self.fields["subj"] = ModelChoiceField(
queryset=self._meta.model.subj_model.objects.all().order_by("id")
)
self.fields["obj"] = ModelChoiceField(
queryset=self._meta.model.obj_model.objects.all().order_by("id")
)
class TibScholRelationMixinForm(RelationForm):
# position the subject/object field on top
field_order = ["subj", "subj_ct_and_id", "obj", "obj_ct_and_id"]


class PlaceForm(TibscholEntityForm):
Expand Down Expand Up @@ -168,28 +152,3 @@ class InstanceSearchForm(GenericFilterSetForm):
"comments",
"external_links",
]


class TibScholRelationMixinSearchForm(GenericFilterSetForm):
field_order = ["columns", "subj", "obj"]

def __init__(
self,
*args,
**kwargs,
):
super().__init__(*args, **kwargs)
model = apps.get_model(
"apis_ontology", self.__class__.__name__[: -len("FilterSetForm")]
)

self.fields["subj"] = ModelChoiceField(
queryset=model.subj_model.objects.all().order_by("id"),
required=False,
widget=forms.Select(attrs={"class": "form-control"}),
)
self.fields["obj"] = ModelChoiceField(
queryset=model.obj_model.objects.all().order_by("id"),
required=False,
widget=forms.Select(attrs={"class": "form-control"}),
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Generated by Django 5.1.2 on 2024-11-05 04:51

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("apis_ontology", "0029_alter_versioninstance_options_and_more"),
]

operations = [
migrations.AlterModelOptions(
name="versioninstance",
options={
"get_latest_by": ("history_date", "history_id"),
"ordering": ("-history_date", "-history_id"),
"verbose_name": "historical instance",
"verbose_name_plural": "historical Instances",
},
),
migrations.AlterModelOptions(
name="versionperson",
options={
"get_latest_by": ("history_date", "history_id"),
"ordering": ("-history_date", "-history_id"),
"verbose_name": "historical person",
"verbose_name_plural": "historical Persons",
},
),
migrations.AlterModelOptions(
name="versionplace",
options={
"get_latest_by": ("history_date", "history_id"),
"ordering": ("-history_date", "-history_id"),
"verbose_name": "historical place",
"verbose_name_plural": "historical Places",
},
),
migrations.AlterModelOptions(
name="versionwork",
options={
"get_latest_by": ("history_date", "history_id"),
"ordering": ("-history_date", "-history_id"),
"verbose_name": "historical work",
"verbose_name_plural": "historical Works",
},
),
]
Loading

0 comments on commit 6fc3f59

Please sign in to comment.