diff --git a/categories/admin.py b/categories/admin.py index ac4712a..8310df3 100644 --- a/categories/admin.py +++ b/categories/admin.py @@ -3,7 +3,7 @@ from django.contrib import admin from django import forms from django.template.defaultfilters import slugify from mptt.forms import TreeNodeChoiceField -from editor import TreeEditorMixin +from editor.tree_editor import TreeEditor class NullTreeNodeChoiceField(forms.ModelChoiceField): """A ModelChoiceField for tree nodes.""" @@ -57,7 +57,7 @@ class CategoryAdminForm(forms.ModelForm): return self.cleaned_data -class CategoryAdmin(TreeEditorMixin, admin.ModelAdmin): +class CategoryAdmin(TreeEditor, admin.ModelAdmin): form=CategoryAdminForm list_display = ('__unicode__',) search_fields = (('name',)) diff --git a/categories/models.py b/categories/models.py index 2b253f5..2f89377 100644 --- a/categories/models.py +++ b/categories/models.py @@ -24,7 +24,7 @@ class Category(models.Model): class Meta: verbose_name_plural = 'categories' unique_together = ('parent', 'name') - ordering = ('name',) + ordering = ('tree_id','lft') def __unicode__(self): ancestors = self.get_ancestors() diff --git a/categories/templates/admin/editor/_messages.html b/categories/templates/admin/editor/_messages.html deleted file mode 100644 index 609c643..0000000 --- a/categories/templates/admin/editor/_messages.html +++ /dev/null @@ -1,8 +0,0 @@ -{% load i18n %} - - DELETE_MESSAGES = ["{% trans "Really delete item?" %}", "{% trans "Confirm to delete item" %}", - "{% trans "Item deleted successfully." %}", "{% trans "Cannot delete item" %}", - "{% trans "Cannot delete item, because it is parent of at least one other item." %}"]; - TREE_SAVED_MESSAGE = "{% trans "Tree saved successfully." %}"; - CHANGE_TEMPLATE_MESSAGES = ["{% trans "Change template" %}", - "{% trans "Really change template?
All content will be moved to main region." %}"]; diff --git a/categories/templates/admin/editor/box.html b/categories/templates/admin/editor/box.html deleted file mode 100644 index 9d08e3b..0000000 --- a/categories/templates/admin/editor/box.html +++ /dev/null @@ -1 +0,0 @@ -
{{ content|safe }}
diff --git a/categories/templates/admin/editor/editor.html b/categories/templates/admin/editor/editor.html deleted file mode 100644 index 666c16a..0000000 --- a/categories/templates/admin/editor/editor.html +++ /dev/null @@ -1,57 +0,0 @@ -{% extends "admin/change_form.html" %} -{% load i18n admin_modify adminmedia %} - - -{% block extrahead %}{{ block.super }} - - - - - - - - - - - - - - -{% for inc in object.item_editor_includes.head %}{% include inc %}{% endfor %} - - -{% endblock %} - -{% block content %} -
- -
-
-{% if is_popup %}{% endif %} - - - {{ form }} -
- -
- -
- -
-
- -
-{% endblock %} diff --git a/categories/templates/admin/editor/editor_done.html b/categories/templates/admin/editor/editor_done.html deleted file mode 100644 index 5ec0b5d..0000000 --- a/categories/templates/admin/editor/editor_done.html +++ /dev/null @@ -1,12 +0,0 @@ - - - -
- {{ content|safe }} -
- - diff --git a/categories/templates/admin/editor/item_editor.html b/categories/templates/admin/editor/item_editor.html deleted file mode 100644 index 41b0df8..0000000 --- a/categories/templates/admin/editor/item_editor.html +++ /dev/null @@ -1,252 +0,0 @@ -{% extends "admin/change_form.html" %} -{% load i18n admin_modify adminmedia %} - -{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %} -{% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %} - -{% block extrahead %}{{ block.super }} - - - - - - - - - - - - - - -{% for inc in object.feincms_item_editor_includes.head %}{% include inc %}{% endfor %} - - - - - - -{% endblock %} - -{% block breadcrumbs %} - -{% endblock %} - -{% block content %} - -
- -{% block object-tools %} - -{% endblock %} - -
-
- - - - -
- {% for field in top_fieldset %} -
- {% ifequal field.name "language" %} - {# Maybe this should be moved somewhere else, since this is specific for translated objects... #} - {% with object.available_translations as translations %} - {% if translations %} -
- {% trans "available translations" %}: - {% for translation in translations %} - {{ translation.language|upper }}{% if not forloop.last %},{% endif %} - {% endfor %} -
- {% endif %} - {% endwith %} - {% endifequal %} - - {{ field.label_tag }}{{ field }} - {% if field.field.help_text %}

{{ field.field.help_text|safe }}

{% endif %} -
- {% endfor %} - - {% if object_form.template_key %} {# Maybe this should be moved somewhere else, since this is page-module-specific #} -
- {{ object_form.template_key.label_tag }} - {{ object_form.template_key }}{{ object_form.template_key.errors }} - -
- {% endif %} -
- -
- - {% for region in object.template.regions %} - - {% endfor %} -
-
- {% for field in settings_fieldset %} -
- {{ field.label_tag }}{{ field }} - {% if field.field.help_text %}

{{ field.field.help_text|safe }}

{% endif %} -
- {% endfor %} -
- - {% for region in object.template.regions %} -
-
- {% trans "Region empty" %} -
-
- {% if region.inherited %} - {% trans "Content from the parent site is automatically inherited. To override this behaviour, add some content." %} - {% endif %} -
- -
- -
-
- {% trans "Add new item" %}:
- - -
-
- {% trans "Move selected item to" %}:
- - -
-
-
- {% endfor %} -
-
- - - -
-{% for formset in inline_formsets %} -
-
- {{ formset.management_form }} -
- {% for form in formset.forms %} -
- {% for field in form %} - {% if field.is_hidden %} - {{ field }} - {% else %} -
- {{ field.label_tag }}{{ field }} - {% if field.field.help_text %}

{{ field.field.help_text|safe }}

{% endif %} -
- {% endif %} - {% endfor %} -
- {% endfor %} -
-{% endfor %} -
- -
-
- -
-{% endblock %} - diff --git a/categories/templates/admin/editor/tools.html b/categories/templates/admin/editor/tools.html deleted file mode 100644 index ea78b21..0000000 --- a/categories/templates/admin/editor/tools.html +++ /dev/null @@ -1,81 +0,0 @@ -{% load i18n %} -
- {% trans "edit" %} - -
- - - diff --git a/categories/templates/admin/editor/tree_editor.html b/categories/templates/admin/editor/tree_editor.html deleted file mode 100644 index 9c95526..0000000 --- a/categories/templates/admin/editor/tree_editor.html +++ /dev/null @@ -1,168 +0,0 @@ -{% extends "admin/change_list.html" %} -{% load i18n admin_modify adminmedia %} -{% block title %}{{ block.super }}{% endblock %} - -{% block extrahead %}{{ block.super }} - - - - - - - - - - - - - - - - -{% endblock %} - -{% block cols %} - 13 -{% endblock %} -{% block content %} - -
- {% block object-tools %} - {% if has_add_permission %} - - {% endif %} - {% endblock %} - - - -
-

- {% trans "Expand all" %} - {% trans "Collapse all" %} -

- - - - {% for header in result_headers %} - {{ header.text|capfirst }} - {% endfor %} - - - - - - -
{% trans "Delete" %}
-
- -
- -{% endblock %}