diff --git a/armstrong/apps/related_content/admin.py b/armstrong/apps/related_content/admin.py index 0efa62e..7ef5031 100644 --- a/armstrong/apps/related_content/admin.py +++ b/armstrong/apps/related_content/admin.py @@ -8,6 +8,8 @@ from .models import RelatedContent from .models import RelatedType +from armstrong.hatband.utils import static_url + """ Setting ARMSTRONG_RELATED_TYPE_DEFAULT_FILTER allows you to specify @@ -19,12 +21,10 @@ class RelatedContentInlineForm(forms.ModelForm): class Meta: widgets = { - "destination_type": forms.HiddenInput(), - "destination_id": widgets.GenericKeyWidget( + "destination_id": widgets.RawGenericKeyWidget( object_id_name="destination_id", content_type_name="destination_type", ), - "order": forms.HiddenInput(), } @@ -33,8 +33,7 @@ class RelatedContentInline(GenericTabularInline): ct_fk_field = "source_id" model = RelatedContent - template = "admin/edit_inline/generickey.html" - + template = 'admin/edit_inline/related_content.html' form = RelatedContentInlineForm def formfield_for_foreignkey(self, *args, **kwargs): diff --git a/armstrong/apps/related_content/static/admin/related_content/related_content_inline.js b/armstrong/apps/related_content/static/admin/related_content/related_content_inline.js new file mode 100644 index 0000000..25adb7e --- /dev/null +++ b/armstrong/apps/related_content/static/admin/related_content/related_content_inline.js @@ -0,0 +1,7 @@ +(function($){ + $(document).ready(function(){ + $('.inline-related .add-row a').click(function(){ + alert('maybe?'); + }); + }); +})(django.jQuery); diff --git a/armstrong/apps/related_content/templates/admin/edit_inline/related_content.html b/armstrong/apps/related_content/templates/admin/edit_inline/related_content.html new file mode 100644 index 0000000..0aeca57 --- /dev/null +++ b/armstrong/apps/related_content/templates/admin/edit_inline/related_content.html @@ -0,0 +1,137 @@ +{% load i18n adminmedia admin_modify %} +
+ +
+ + +