diff --git a/pandora/app/views.py b/pandora/app/views.py index 60f8f3546..71decff8e 100644 --- a/pandora/app/views.py +++ b/pandora/app/views.py @@ -91,3 +91,4 @@ def redirect_url(request, url): return redirect(url) else: return HttpResponse(''%json.dumps(url)) + diff --git a/pandora/archive/admin.py b/pandora/archive/admin.py index 93c8c3f16..573d21b92 100644 --- a/pandora/archive/admin.py +++ b/pandora/archive/admin.py @@ -3,7 +3,6 @@ from django.contrib import admin -from forms import FileAdminForm, InstanceAdminForm import models @@ -15,13 +14,11 @@ class FileAdmin(admin.ModelAdmin): def itemId(self, obj): return '%s'%(obj.item.itemId) - form = FileAdminForm admin.site.register(models.File, FileAdmin) class InstanceAdmin(admin.ModelAdmin): search_fields = ['path', 'volume__name', 'file__oshash'] - form = InstanceAdminForm admin.site.register(models.Instance, InstanceAdmin) diff --git a/pandora/archive/forms.py b/pandora/archive/forms.py index 04221754e..0e2ac95b9 100644 --- a/pandora/archive/forms.py +++ b/pandora/archive/forms.py @@ -1,4 +1,3 @@ -from ajax_filtered_fields.forms import ForeignKeyByLetter from django.conf import settings from django import forms @@ -6,29 +5,3 @@ import models from item.models import Item -ajax_filtered_js = ( - settings.ADMIN_MEDIA_PREFIX + "js/SelectBox.js", - settings.ADMIN_MEDIA_PREFIX + "js/SelectFilter2.js", - settings.STATIC_URL + 'js/jquery/jquery.js', - settings.STATIC_URL + 'js/ajax_filtered_fields.js', -) - - -class FileAdminForm(forms.ModelForm): - item = ForeignKeyByLetter(Item, field_name='itemId') - - class Meta: - model = models.File - - class Media: - js = ajax_filtered_js - - -class InstanceAdminForm(forms.ModelForm): - file = ForeignKeyByLetter(models.File, field_name='path') - - class Meta: - model = models.Instance - - class Media: - js = ajax_filtered_js diff --git a/pandora/item/forms.py b/pandora/item/forms.py index 664b728bb..acad24787 100644 --- a/pandora/item/forms.py +++ b/pandora/item/forms.py @@ -1,20 +1,2 @@ -from ajax_filtered_fields.forms import AjaxManyToManyField, ForeignKeyByLetter from django.conf import settings -ajax_filtered_js = ( - settings.ADMIN_MEDIA_PREFIX + "js/SelectBox.js", - settings.ADMIN_MEDIA_PREFIX + "js/SelectFilter2.js", - settings.STATIC_URL + 'js/jquery/jquery.js', - settings.STATIC_URL + 'js/ajax_filtered_fields.js', -) -""" -class ItemAdminForm(forms.ModelForm): - imdb = ForeignKeyByLetter(models.ItemImdb, field_name='title') - oxdb = ForeignKeyByLetter(models.ItemOxdb, field_name='title') - - class Meta: - model = models.Item - - class Media: - js = ajax_filtered_js -""" diff --git a/requirements.txt b/requirements.txt index 71ee76bbf..a083ef367 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,6 @@ -e bzr+http://code.0x2620.org/oxtimeline/#egg=oxtimeline simplejson chardet --e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields celery>2.1.1 django-celery>2.1.1 #django_extensions diff --git a/static/js/ajax_filtered_fields.js b/static/js/ajax_filtered_fields.js deleted file mode 100644 index 887348daf..000000000 --- a/static/js/ajax_filtered_fields.js +++ /dev/null @@ -1,91 +0,0 @@ -ajax_filtered_fields = { - - request_url: "/ajax_filtered_fields/json_index/", - data_loaded: "data_loaded", - - _appendOption: function(obj, selector) { - // append a json data row as an option to the selector - var option = $(''); - option.attr({value: obj[0]}); - option.appendTo(selector); - return option; - }, - - _removeOptions: function(selector) { - // remove all options from selector - selector.children("option").each(function(i) { - $(this).remove(); - }); - }, - - getManyToManyJSON: function(element_id, app_label, object_name, - lookup_string, select_related) { - // manage the ManyToMany ajax request - var selector_from = $("#" + element_id + "_from"); - var selector_to = $("#" + element_id + "_to"); - - $("#" + element_id + "_input").val(""); - selector_from.attr("disabled", true); - selector_to.attr("disabled", true); - - this._removeOptions(selector_from); - - $.getJSON(this.request_url, { - app_label: app_label, - object_name: object_name, - lookup_string: lookup_string, - select_related: select_related}, - function(data){ - $.each(data, function(i, obj){ - var option_is_selected = selector_to.children("option[value='" + obj[0] + "']").length; - if (!option_is_selected) { - ajax_filtered_fields._appendOption(obj, selector_from); - }; - }); - SelectBox.init(element_id + "_from"); - selector_from.attr("disabled", false); - selector_to.attr("disabled", false); - selector_from.trigger(ajax_filtered_fields.data_loaded); - }); - }, - - getForeignKeyJSON: function(element_id, app_label, object_name, - lookup_string, select_related) { - // manage the ForeignKey ajax request - var selector = $("#" + element_id); - var hidden = $("#hidden-" + element_id); - - $("#" + element_id + "_input").val(""); - selector.attr("disabled", true); - - this._removeOptions(selector); - - $.getJSON(this.request_url, { - app_label: app_label, - object_name: object_name, - lookup_string: lookup_string, - select_related: select_related}, - function(data){ - var selection = hidden.val(); - ajax_filtered_fields._appendOption(new Array("", "---------"), selector); - $.each(data, function(i, obj){ - ajax_filtered_fields._appendOption(obj, selector); - }); - selector.children("option[value='" + selection + "']").attr("selected", "selected"); - selector.attr("disabled", false); - SelectBox.init(element_id); - ajax_filtered_fields.bindForeignKeyOptions(element_id); - selector.trigger(ajax_filtered_fields.data_loaded); - }); - }, - - bindForeignKeyOptions: function(element_id) { - // bind the dummy options to the hidden field that do the work - var selector = $("#" + element_id); - var hidden = $("#hidden-" + element_id); - selector.change(function(e) { - hidden.val($(this).val()); - }); - } - -};