Skip to content

Commit

Permalink
Merge branch 'release/0.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
abidibo committed May 30, 2024
2 parents 75b0277 + cf0d873 commit 05cca84
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 6 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
History
-------

0.3.2 (2024-05-30)
++++++++++++++++++

* Adds rebuild command in admin

0.3.1 (2022-12-22)
++++++++++++++++++

Expand Down
9 changes: 9 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ Add it to your `INSTALLED_APPS`:
...
)
Add to your main `urls.py`:

.. code-block:: python
...
path("lineup/", include("lineup.urls", namespace="lineup")),
...
Make sure the ``requests`` context processor is included (it is by default):

.. code-block:: python
Expand Down Expand Up @@ -134,6 +142,7 @@ Features
- Render menu tree templatetags
- Breadcrumbs templetetag
- Import a menu from json management command
- Rebuild tree button in admin
- `Django Baton <https://github.com/otto-torino/django-baton>`_ integration to highlight different menu in the admin

Running Tests
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
# built documents.
#
# The short X.Y version.
version = u'0.3.1'
version = u'0.3.2'
# The full version, including alpha/beta/rc tags.
release = u'0.3.1'
release = u'0.3.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
8 changes: 8 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ To use Django Lineup in a project, add it to your `INSTALLED_APPS`:
...
)
Add to your main `urls.py`:

.. code-block:: python
...
path("lineup/", include("lineup.urls", namespace="lineup")),
...
Be sure the ``requests`` context processor is included (it is by default):

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion lineup/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.3.1'
__version__ = '0.3.2'
1 change: 1 addition & 0 deletions lineup/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class MenuItemInline(admin.StackedInline):

@admin.register(MenuItem)
class MenuItemAdmin(MPTTModelAdmin):
change_list_template = "admin/lineup/menuitem/change_list.html"
list_display = ('slug', 'label', 'parent', 'link', 'order', 'login_required', 'enabled', )
list_filter = (('parent', RelatedDropdownFilter, ) if baton else 'parent', 'enabled', 'login_required', )
list_editable = ('order', )
Expand Down
13 changes: 13 additions & 0 deletions lineup/templates/admin/lineup/menuitem/change_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends "admin/change_list.html" %}
{% load admin_list i18n mptt_admin %}

{% block result_list %}
{% if action_form and actions_on_top and cl.show_admin_actions %}{% admin_actions %}{% endif %}
{% mptt_result_list cl %}
{% if action_form and actions_on_bottom and cl.show_admin_actions %}{% admin_actions %}{% endif %}
{% endblock %}

{% block object-tools-items %}
<li><a href="{% url 'lineup:rebuild' %}" class="rebuildlink">{% trans "Rebuild" %}</a></li>
{{ block.super }}
{% endblock %}
8 changes: 8 additions & 0 deletions lineup/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.urls import path

from . import views

app_name = "lineup"
urlpatterns = [
path("", views.RebuildTreeView.as_view(), name="rebuild"),
]
10 changes: 9 additions & 1 deletion lineup/views.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# -*- coding: utf-8 -*-
from django.urls import reverse
from django.views.generic import View
from django.shortcuts import redirect
from .models import MenuItem

class RebuildTreeView(View):
def get(self, request):
MenuItem.objects.rebuild()
return redirect(reverse('admin:lineup_menuitem_changelist'))
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[bumpversion]
current_version = 0.3.1
current_version = 0.3.2

[wheel]
universal = 1

[flake8]
ignore = D203
exclude =
exclude =
lineup/migrations,
.git,
.tox,
Expand Down

0 comments on commit 05cca84

Please sign in to comment.