Skip to content

Commit

Permalink
refactor(forms)!: drop unused form
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Aug 26, 2024
1 parent aee11cf commit 7870d50
Showing 1 changed file with 1 addition and 40 deletions.
41 changes: 1 addition & 40 deletions apis_bibsonomy/forms.py
Original file line number Diff line number Diff line change
@@ -1,49 +1,10 @@
from django.forms import ModelForm, HiddenInput
from django.urls import reverse
from django.forms import ModelForm
from .models import Reference
from dal.autocomplete import ListSelect2
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Row, Column, Div


class ReferenceForm(ModelForm):
class Meta:
model = Reference
fields = "__all__"
attrs = {"data-placeholder": "Type to get suggestions", "data-html": True}
widgets = {
"bibs_url": ListSelect2(url="bibsonomy:bibsonomyautocomplete", attrs=attrs)
}

def __init__(
self,
content_type=None,
object_pk=None,
attribute_name=None,
hidden=False,
*args,
**kwargs,
):
ModelForm.__init__(self, *args, **kwargs)
self.helper = FormHelper(self)
self.helper.add_input(Submit("submit", "Submit", css_class="btn-primary"))
self.helper.form_id = "bibs-form"
self.helper.form_class = "bibs-forms"
self.helper.form_action = reverse("bibsonomy:savegetbibsonomyentry")
self.fields["pages_start"].widget.attrs["class"] = "form-control"
self.fields["pages_end"].widget.attrs["class"] = "form-control"
self.fields["bibtex"].widget = HiddenInput()
self.fields["content_type"].widget = HiddenInput()
self.fields["attribute"].widget = HiddenInput()
self.fields["object_id"].widget = HiddenInput()
if content_type is not None:
self.fields["content_type"].initial = content_type
if object_pk is not None:
self.fields["object_id"].initial = object_pk
if attribute_name is not None:
self.fields["attribute"].initial = attribute_name


class ReferenceNewForm(ModelForm):
class Meta:
model = Reference
Expand Down

0 comments on commit 7870d50

Please sign in to comment.