Skip to content

Commit d31190c

Browse files
committed
Fix color picker for brands
1 parent 81d4edf commit d31190c

File tree

6 files changed

+4056
-2478
lines changed

6 files changed

+4056
-2478
lines changed

admin/brands/views.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ class BrandChangeForm(PermissionRequiredMixin, UpdateView):
6060
raise_exception = True
6161
model = Brand
6262
form_class = BrandForm
63+
template_name = 'brands/detail.html'
64+
65+
def get_context_data(self, **kwargs):
66+
context = super().get_context_data(**kwargs)
67+
context['change_form'] = context.get('form')
68+
brand_obj = self.get_object()
69+
context['brand'] = model_to_dict(brand_obj)
70+
return context
6371

6472
def get_object(self, queryset=None):
6573
brand_id = self.kwargs.get('brand_id')

admin/static/js/banners/banners.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ $(document).ready(function() {
2626
}
2727
});
2828

29-
$(".colorpicker").colorpicker();
29+
$(".colorpicker").colorpicker({
30+
format: 'hex',
31+
useAlpha: false
32+
});
3033

3134
});

admin/static/js/brands/brands.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ require('bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css');
55

66
$(document).ready(function() {
77

8-
$(".colorpicker").colorpicker();
8+
$(".colorpicker").colorpicker({
9+
format: 'hex',
10+
useAlpha: false
11+
});
912

1013
});

admin/webpack.prod.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = assign(admin, {
1818
'__DEV__': false
1919
}),
2020
new UglifyJsPlugin({
21-
exclude: /conference.*?\.js$/,
21+
exclude: /(conference|metrics).*?\.js$/,
2222
sourceMap: true,
2323
uglifyOptions: {warnings: true},
2424
}),

0 commit comments

Comments
 (0)