Repository: zostera/django-bootstrap4

Issue:
Setting base_url is not used
I tried to change the used bootstrap4 version. So I added to following dict to the settings.py:

`BOOTSTRAP4 = {
    # The Bootstrap base URL
    'base_url': '//maxcdn.bootstrapcdn.com/bootstrap/4.1.3/',
}`

But the tag {% bootstrap_css %} still includes version 4.0.0:

`<link crossorigin="anonymous" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" rel="stylesheet">`


Discussion:
Do you have a `css_url` defined in settings?
No, the `css_url` is not set in my settings file. As I understod the documentation, if I didn't set a `css_url` the url will be build from the `base_url`. Is this correct? 
Yes, that's why I asked. I'll investigate.
Could you try if it works if you *explicitly* set`css_url` to `None`? I think the problem is that there is a default value for `css_url`.
I've confirmed this is due to a change in the defaults. The CDN version of BS4 used to be provided by a `base_url`. In order to accommodate crossorigin/integrity, the defaults are now in a `css_url` and `javascript_url`.

This will require a fix, and the fix may require some discussion.

Workaround for now: explicitly set `css_url` to `None` in your settings, and your `base_url` will work.
Suggestion (thanks @jieter). Let's get rid of `base_url` as a magic way to include stuff, and just have an explicit `javascript_url` and `css_url` that default to the CDN. This would be a breaking change.
@pacnos Would you that be an acceptable direction for you?

Resolving patch:
diff --git a/bootstrap4/bootstrap.py b/bootstrap4/bootstrap.py
--- a/bootstrap4/bootstrap.py
+++ b/bootstrap4/bootstrap.py
@@ -8,12 +8,16 @@
 # Default settings
 
 BOOTSTRAP4_DEFAULTS = {
-    "base_url": None,  # 'https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/'
     "css_url": {
         "href": "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css",
         "integrity": "sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB",
         "crossorigin": "anonymous",
     },
+    "javascript_url": {
+        "url": "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js",
+        "integrity": "sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T",
+        "crossorigin": "anonymous",
+    },
     "theme_url": None,
     "jquery_url": {
         "url": "https://code.jquery.com/jquery-3.3.1.min.js",
@@ -30,11 +34,6 @@
         "integrity": "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49",
         "crossorigin": "anonymous",
     },
-    "javascript_url": {
-        "url": "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js",
-        "integrity": "sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T",
-        "crossorigin": "anonymous",
-    },
     "javascript_in_head": False,
     "include_jquery": False,
     "use_i18n": False,
@@ -69,13 +68,6 @@ def get_bootstrap_setting(name, default=None):
     return BOOTSTRAP4.get(name, default)
 
 
-def bootstrap_url(postfix):
-    """
-    Prefix a relative url with the bootstrap base url
-    """
-    return get_bootstrap_setting("base_url") + postfix
-
-
 def jquery_url():
     """
     Return the full url to jQuery library file to use
@@ -110,16 +102,14 @@ def javascript_url():
     """
     Return the full url to the Bootstrap JavaScript file
     """
-    url = get_bootstrap_setting("javascript_url")
-    return url if url else bootstrap_url("js/bootstrap.min.js")
+    return get_bootstrap_setting("javascript_url")
 
 
 def css_url():
     """
     Return the full url to the Bootstrap CSS file
     """
-    url = get_bootstrap_setting("css_url")
-    return url if url else bootstrap_url("css/bootstrap.min.css")
+    return get_bootstrap_setting("css_url")
 
 
 def theme_url():


Test patch:
diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py
--- a/tests/test_templatetags.py
+++ b/tests/test_templatetags.py
@@ -232,17 +232,6 @@ def test_bootstrap_css_tag(self):
             '<link rel="stylesheet" href="//example.com/theme.css">', html
         )
 
-    @override_settings(BOOTSTRAP4={"base_url": "//example.com/", "css_url": None})
-    def test_bootstrap_css_from_base_url(self):
-        self.assertEqual(
-            render_template_with_form("{% bootstrap_css_url %}").strip(),
-            "//example.com/css/bootstrap.min.css",
-        )
-        self.assertInHTML(
-            '<link href="//example.com/css/bootstrap.min.css" rel="stylesheet">',
-            render_template_with_form("{% bootstrap_css %}").strip(),
-        )
-
     def test_settings_filter(self):
         res = render_template_with_form('{{ "required_css_class"|bootstrap_setting }}')
         self.assertEqual(res.strip(), "bootstrap4-req")