Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimum changes to make it work for Djnago 3.2 #785

Open
wants to merge 6 commits into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion suit/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin
from django.core.exceptions import FieldDoesNotExist
from django.db import models
from django.utils.safestring import mark_safe
try:
Expand Down Expand Up @@ -93,7 +94,7 @@ def get_queryset(self, request):
for field_name in self.list_display:
try:
field = model._meta.get_field(field_name)
except models.FieldDoesNotExist:
except FieldDoesNotExist:
continue

if isinstance(field.remote_field, models.ManyToOneRel):
Expand Down
2 changes: 1 addition & 1 deletion suit/admin_filters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.contrib.admin import FieldListFilter


Expand Down
4 changes: 2 additions & 2 deletions suit/sass/layout/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ body.change-form {
> a {
&:not([class*="btn-"]) {
@extend .btn-round;
@include btn-mixin(info, none, sm, round=true);
@include btn-mixin(info, $icon-plus-circle, sm, true);
&.addlink {
@include btn-mixin(success, $icon-plus-circle, sm, round=true);
@include btn-mixin(success, $icon-plus-circle, sm, true);
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions suit/sass/layout/_vertical.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ body.suit_layout_vertical:not(.login) {
display: flex;
position: relative;
align-content: flex-start;
#main {
width: 100%;
}
#header {
display: flex;
flex-direction: column;
Expand Down
8 changes: 5 additions & 3 deletions suit/sass/pages/_changelist.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ $filter-col-width: 15rem;
}
}
}
#changelist-filter:not(:empty) + #changelist-form {
#changelist-filter:not(:empty) + .changelist-form-container {
margin-right: 2rem;
}
#toolbar {
margin-bottom: 1.5rem;
margin-bottom: 1.16rem;
#changelist-search {
label {
display: none;
Expand All @@ -51,6 +51,8 @@ $filter-col-width: 15rem;
}
}
#changelist-filter {
margin-top: 0.35rem;
margin-left: 2rem;
float: right;
width: $filter-col-width;
//position: absolute;
Expand Down Expand Up @@ -94,7 +96,7 @@ $filter-col-width: 15rem;
}
}
}
#changelist-form {
.changelist-form-container {
flex: 1;
.actions {
margin: -.5rem 0 1rem 0;
Expand Down
2 changes: 1 addition & 1 deletion suit/sortables.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SortableModelAdminBase(object):
sortable = 'order'

class Media:
js = ('suit/js/suit.sortables.js',)
js = ('admin/js/jquery.init.js', 'suit/js/suit.sortables.js',)


class SortableListForm(ModelForm):
Expand Down
561 changes: 278 additions & 283 deletions suit/static/suit/css/suit.css

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions suit/templates/admin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ <h1 id="site-name">
{% include 'suit/menu.html' %}
{% endblock %}

{% block nav-sidebar %}
{% include "suit/nav_sidebar.html" %}
{% endblock %}


{% block footer %}
{# </div> <!-- Put footer outside #container -->#}
{% if not is_popup %}
Expand Down
1 change: 1 addition & 0 deletions suit/templates/suit/nav_sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- This is to temporarily remove the sidebar not compatible with django-suit. -->
1 change: 1 addition & 0 deletions suit/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'django.contrib.sessions',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.messages',
'django.contrib.sites',
]

Expand Down
11 changes: 6 additions & 5 deletions suit/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def media(self):
return forms.Media(js=('suit/js/autosize.min.js',))

def render(self, name, value, attrs=None, renderer=None):
output = super(AutosizedTextarea, self).render(name, value, attrs,renderer)
output = super(AutosizedTextarea, self).render(name, value, attrs)
output += mark_safe(
"<script type=\"text/javascript\">django.jQuery(function () { autosize(document.getElementById('id_%s')); });</script>"
% name)
Expand All @@ -30,7 +30,7 @@ class CharacterCountTextarea(AutosizedTextarea):
"""

def render(self, name, value, attrs=None, renderer=None):
output = super(CharacterCountTextarea, self).render(name, value, attrs, renderer)
output = super(CharacterCountTextarea, self).render(name, value, attrs)
output += mark_safe(
"<script type=\"text/javascript\">django.jQuery(function () { django.jQuery('#id_%s').suitCharactersCount(); });</script>"
% name)
Expand All @@ -53,23 +53,24 @@ class EnclosedInput(TextInput):
Widget for bootstrap appended/prepended inputs
"""

def __init__(self, attrs=None, prepend=None, append=None, prepend_class='addon', append_class='addon'):
def __init__(self, attrs=None, prepend=None, append=None, prepend_class='addon', append_class='addon', onclick_append=None):
"""
:param prepend_class|append_class: CSS class applied to wrapper element. Values: addon or btn
"""
self.prepend = prepend
self.prepend_class = prepend_class
self.append = append
self.append_class = append_class
self.onclick_append = onclick_append
super(EnclosedInput, self).__init__(attrs=attrs)

def enclose_value(self, value, wrapper_class):
if value.startswith("fa-"):
value = '<i class="fa %s"></i>' % value
return '<span class="input-group-%s">%s</span>' % (wrapper_class, value)
return '<span class="input-group-text input-group-%s"%s>%s</span>' % (wrapper_class, "onclick="+self.onclick_append if self.onclick_append else "", value)

def render(self, name, value, attrs=None, renderer=None):
output = super(EnclosedInput, self).render(name, value, attrs, renderer)
output = super(EnclosedInput, self).render(name, value, attrs)
div_classes = set()
if self.prepend:
div_classes.add('input-group')
Expand Down