GithubHelp home page GithubHelp logo

jazzband / django-flatblocks Goto Github PK

View Code? Open in Web Editor NEW
83.0 83.0 33.0 220 KB

django-chunks + headerfield + variable chunknames + "inclusion tag" == django-flatblocks

License: BSD 3-Clause "New" or "Revised" License

Python 97.12% HTML 2.88%

django-flatblocks's People

Contributors

ad-m avatar aleksihakli avatar artofhuman avatar bashu avatar craiga avatar ebrelsford avatar euphoria avatar funkybob avatar hheimbuerger avatar howiworkdaily avatar ipmb avatar jazzband-bot avatar jezdez avatar kmike avatar koirikivi avatar lorddaedra avatar martey avatar petebrowne avatar psycojoker avatar sir-sigurd avatar stephrdev avatar svetlyak40wt avatar uggedal avatar wjurkowlaniec avatar woochica avatar zerok avatar zodman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-flatblocks's Issues

Installation error

Several months ago I replaced django-flatblocks==0.9.4 with git+https://github.com/jazzband/django-flatblocks because of some error with (latest stable) Django 3.1. It worked. But now even master is broken...

Step #0: + python3 -m pip install --no-cache-dir --upgrade '--upgrade-strategy=eager' git+https://github.com/jazzband/django-flatblocks
Step #0: Collecting git+https://github.com/jazzband/django-flatblocks
Step #0:   Cloning https://github.com/jazzband/django-flatblocks to /tmp/pip-req-build-xh36avr6
Step #0:   Running command git clone -q https://github.com/jazzband/django-flatblocks /tmp/pip-req-build-xh36avr6
Step #0:     ERROR: Command errored out with exit status 1:
Step #0:      command: /usr/local/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-xh36avr6/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-xh36avr6/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ehajisg1
Step #0:          cwd: /tmp/pip-req-build-xh36avr6/
Step #0:     Complete output (33 lines):
Step #0:     /tmp/pip-req-build-xh36avr6/.eggs/setuptools_scm-5.0.2-py3.8.egg/setuptools_scm/version.py:88: UserWarning: tag 'release/0.9.4' no version found
Step #0:       warnings.warn("tag {!r} no version found".format(tag))
Step #0:     Traceback (most recent call last):
Step #0:       File "<string>", line 1, in <module>
Step #0:       File "/tmp/pip-req-build-xh36avr6/setup.py", line 5, in <module>
Step #0:         setup(
Step #0:       File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
Step #0:         return distutils.core.setup(**attrs)
Step #0:       File "/usr/local/lib/python3.8/distutils/core.py", line 108, in setup
Step #0:         _setup_distribution = dist = klass(attrs)
Step #0:       File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 432, in __init__
Step #0:         _Distribution.__init__(self, {
Step #0:       File "/usr/local/lib/python3.8/distutils/dist.py", line 292, in __init__
Step #0:         self.finalize_options()
Step #0:       File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 735, in finalize_options
Step #0:         ep(self)
Step #0:       File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 742, in _finalize_setup_keywords
Step #0:         ep.load()(self, ep.name, value)
Step #0:       File "/tmp/pip-req-build-xh36avr6/.eggs/setuptools_scm-5.0.2-py3.8.egg/setuptools_scm/integration.py", line 26, in version_keyword
Step #0:         dist.metadata.version = _get_version(config)
Step #0:       File "/tmp/pip-req-build-xh36avr6/.eggs/setuptools_scm-5.0.2-py3.8.egg/setuptools_scm/__init__.py", line 173, in _get_version
Step #0:         parsed_version = _do_parse(config)
Step #0:       File "/tmp/pip-req-build-xh36avr6/.eggs/setuptools_scm-5.0.2-py3.8.egg/setuptools_scm/__init__.py", line 127, in _do_parse
Step #0:         version = _version_from_entrypoints(config) or _version_from_entrypoints(
Step #0:       File "/tmp/pip-req-build-xh36avr6/.eggs/setuptools_scm-5.0.2-py3.8.egg/setuptools_scm/__init__.py", line 65, in _version_from_entrypoints
Step #0:         version = _call_entrypoint_fn(root, config, ep.load())
Step #0:       File "/tmp/pip-req-build-xh36avr6/.eggs/setuptools_scm-5.0.2-py3.8.egg/setuptools_scm/__init__.py", line 46, in _call_entrypoint_fn
Step #0:         return fn(root, config=config)
Step #0:       File "/tmp/pip-req-build-xh36avr6/.eggs/setuptools_scm-5.0.2-py3.8.egg/setuptools_scm/git.py", line 144, in parse
Step #0:         return meta(
Step #0:       File "/tmp/pip-req-build-xh36avr6/.eggs/setuptools_scm-5.0.2-py3.8.egg/setuptools_scm/version.py", line 212, in meta
Step #0:         assert parsed_version is not None, "Can't parse version %s" % tag
Step #0:     AssertionError: Can't parse version release/0.9.4
Step #0:     ----------------------------------------
Step #0: WARNING: Discarding git+https://github.com/jazzband/django-flatblocks. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Flatblocks causing pytest to fail when treating warnings as errors because of docstring

This docstring in flatblocks.views.edit:

        def my_perm_check(request, flatblock):
            return request.user.is_staff

        # ...

        urlpatterns('flatblocks.views',
            url('flatblocks/(?P<pk>\d+)/edit/$', 'edit',
                kwargs={'permission_check': my_perm_check}),
        )

…causes problems with pytest when treating errors as warnings.

In pytest.ini I had the following, which reports warnings as test failures:

filterwarnings =
    error
    ignore::django.utils.deprecation.RemovedInDjango40Warning:debug_toolbar
    ignore::django.utils.deprecation.RemovedInDjango40Warning:allauth

This causes the following error:

../.local/share/virtualenvs/af-gang-mail-5vsZ5Qsv/lib/python3.8/site-packages/_pytest/python.py:511: in _importtestmodule
    mod = self.fspath.pyimport(ensuresyspath=importmode)
../.local/share/virtualenvs/af-gang-mail-5vsZ5Qsv/lib/python3.8/site-packages/py/_path/local.py:704: in pyimport
    __import__(modname)
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
../.local/share/virtualenvs/af-gang-mail-5vsZ5Qsv/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:152: in exec_module
    exec(co, module.__dict__)
af_gang_mail/tests/views/test_draw.py:10: in <module>
    from af_gang_mail.views import Draw
af_gang_mail/views.py:25: in <module>
    from flatblocks import views as flatblocks_views
E     File "/Users/craiga/.local/share/virtualenvs/af-gang-mail-5vsZ5Qsv/src/django-flatblocks/flatblocks/views.py", line 10
E       """
E       ^
E   SyntaxError: invalid escape sequence \d

I can work around this by including the following in filterwarnings:

    ignore:invalid escape sequence \\d:DeprecationWarning:

Release for Django 3 compatibility

Any chance of a new release for Django 3 compatibility?

Running migrations with Django 3 and the latest version on PyPi gives me the following error (I assume this has to do with dropped Python 2 support), but installing directly from git seems to work fine.

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "…/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "…/django/core/management/__init__.py", line 377, in execute
    django.setup()
  File "…/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "…/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "…/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "…/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "…/flatblocks/models.py", line 3, in <module>
    from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (…/django/utils/encoding.py)

Glitch in documentation

The documentation instructs to use {% load flatblock_tags %}
Works for me with {% load flatblocks %}

Thanks for flatblocks. Exactly what I was looking for!

Django 3.2: default_auto_field

Application django-flatblocks displays this warning when used in Django 3.2:

WARNINGS:
flatblocks.FlatBlock: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
	HINT: Configure the DEFAULT_AUTO_FIELD setting or the AppConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.

To solve this issue, there should be a apps.py file with the following content:

from django.apps import AppConfig

class FlatblocksConfig(AppConfig):
    default_auto_field = 'django.db.models.AutoField'

More information here and here.

Rewrite tags to use kwarg syntax

I have this underway... I'm reworking the code to be simpler, cleaner, and use keyword syntax instead of magic positional names.

As an example:

{% flatblock "page.foo" using "mytemplate.html" %}

will become:

{% flatblock "page.foo" using="mytemplate.html" %}

'RequestContext' object has no attribute 'META' (Django 1.10)

I just upgraded to Django 1.10 and Flatblocks don't seem to work anymore. Here's the stack trace:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 39, in inner response = get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 249, in _legacy_get_response response = self._get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 187, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 185, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/var/www/mysite/myapp/views.py", line 1432, in sourcing return render(request, 'my_page.html', locals()) File "/usr/local/lib/python2.7/dist-packages/django/shortcuts.py", line 30, in render content = loader.render_to_string(template_name, context, request, using=using) File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", line 68, in render_to_string return template.render(context, request) File "/usr/local/lib/python2.7/dist-packages/django/template/backends/django.py", line 66, in render return self.template.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 208, in render return self._render(context) File "/usr/local/lib/python2.7/dist-packages/django/test/utils.py", line 94, in instrumented_test_render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 994, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 961, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 174, in render return compiled_parent._render(context) File "/usr/local/lib/python2.7/dist-packages/django/test/utils.py", line 94, in instrumented_test_render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 994, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 961, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 174, in render return compiled_parent._render(context) File "/usr/local/lib/python2.7/dist-packages/django/test/utils.py", line 94, in instrumented_test_render return self.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 994, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 961, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 70, in render result = block.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 994, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 961, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py", line 70, in render result = block.nodelist.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 994, in render bit = node.render_annotated(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 961, in render_annotated return self.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/library.py", line 203, in render output = self.func(*resolved_args, **resolved_kwargs) File "/usr/local/lib/python2.7/dist-packages/flatblocks/templatetags/flatblocks.py", line 91, in flatblock result = render_to_string(using, {'flatblock': flatblock}, context) File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py", line 68, in render_to_string return template.render(context, request) File "/usr/local/lib/python2.7/dist-packages/django/template/backends/django.py", line 66, in render return self.template.render(context) File "/usr/local/lib/python2.7/dist-packages/django/template/base.py", line 206, in render with context.bind_template(self): File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__ return self.gen.next() File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/panels/templates/panel.py", line 49, in _request_context_bind_template context = processor(self.request) File "/usr/local/lib/python2.7/dist-packages/django/template/context_processors.py", line 43, in debug if settings.DEBUG and request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: AttributeError: 'RequestContext' object has no attribute 'META'

Here's how I'm calling it in the template:

... {% load flatblocks %} ... {% flatblock 'my-flatblock' %}

This all worked fine in Django 1.9.9, but I know Django made some changes to render_to_string's parameters in 1.10, so that's likely the cause. Thanks.

Django 1.9 deprecation warnings

Hi,
I'm working on a project that uses django-flatblocks and we recently updated to Django 1.8. I'm trying to get rid of all RemovedInDjango19Warning messages, and put together a pull request to silence one in flatblocks aswell: #14

If you want me to change something in it, just give me a shout!

Pip install fails from master

I can no longer install django flatblocks due to an error during pip install.

The pip install command used was -e git+git://github.com/jazzband/django-flatblocks.git@master#egg=django-flatblocks

I'm installing from a github URL as I need the latest updates, for compatibility with Django 2. I have pinned the requirement now to an older commit to get it working -e git+git://github.com/jazzband/django-flatblocks.git@41a037959f05ad666ee9a1645db1907c81e4bd78#egg=django-flatblocks.

ERROR: Command errored out with exit status 1:
     command: /Users/xxxxxx/.virtualenvs/eb-3-dev/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/setup.py'"'"'; __file__='"'"'/Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/ph/3jc2sm6d611c76mjzj8crfj80000gn/T/pip-pip-egg-info-t312zlun
         cwd: /Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/
    Complete output (34 lines):
    WARNING: The wheel package is not available.
    /Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/.eggs/setuptools_scm-5.0.1-py3.7.egg/setuptools_scm/version.py:88: UserWarning: tag 'release/0.9.4' no version found
      warnings.warn("tag {!r} no version found".format(tag))
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/setup.py", line 50, in <module>
        "Django (>=2.2)",
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "/Users/xxxxxx/.pyenv/versions/3.7.9/lib/python3.7/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/lib/python3.7/site-packages/setuptools/dist.py", line 426, in __init__
        k: v for k, v in attrs.items()
      File "/Users/xxxxxx/.pyenv/versions/3.7.9/lib/python3.7/distutils/dist.py", line 292, in __init__
        self.finalize_options()
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/lib/python3.7/site-packages/setuptools/dist.py", line 717, in finalize_options
        ep(self)
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/lib/python3.7/site-packages/setuptools/dist.py", line 724, in _finalize_setup_keywords
        ep.load()(self, ep.name, value)
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/.eggs/setuptools_scm-5.0.1-py3.7.egg/setuptools_scm/integration.py", line 26, in version_keyword
        dist.metadata.version = _get_version(config)
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/.eggs/setuptools_scm-5.0.1-py3.7.egg/setuptools_scm/__init__.py", line 173, in _get_version
        parsed_version = _do_parse(config)
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/.eggs/setuptools_scm-5.0.1-py3.7.egg/setuptools_scm/__init__.py", line 127, in _do_parse
        version = _version_from_entrypoints(config) or _version_from_entrypoints(
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/.eggs/setuptools_scm-5.0.1-py3.7.egg/setuptools_scm/__init__.py", line 65, in _version_from_entrypoints
        version = _call_entrypoint_fn(root, config, ep.load())
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/.eggs/setuptools_scm-5.0.1-py3.7.egg/setuptools_scm/__init__.py", line 46, in _call_entrypoint_fn
        return fn(root, config=config)
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/.eggs/setuptools_scm-5.0.1-py3.7.egg/setuptools_scm/git.py", line 139, in parse
        branch=branch,
      File "/Users/xxxxxx/.virtualenvs/eb-3-dev/src/django-flatblocks/.eggs/setuptools_scm-5.0.1-py3.7.egg/setuptools_scm/version.py", line 212, in meta
        assert parsed_version is not None, "Can't parse version %s" % tag
    AssertionError: Can't parse version release/0.9.4
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Using Django 1.11, "context must be a dict rather than RequestContext."

Having upgraded to Django 1.11.0, when I use a flatblock in a template I get context must be a dict rather than RequestContext.

  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/core/handlers/base.py", line 217, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/core/handlers/base.py", line 215, in _get_response
    response = response.render()
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/response.py", line 107, in render
    self.content = self.rendered_content
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/response.py", line 84, in rendered_content
    content = template.render(context, self._request)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/backends/django.py", line 66, in render
    return self.template.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 207, in render
    return self._render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/test/utils.py", line 107, in instrumented_test_render
    return self.nodelist.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 990, in render
    bit = node.render_annotated(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 957, in render_annotated
    return self.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/loader_tags.py", line 177, in render
    return compiled_parent._render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/test/utils.py", line 107, in instrumented_test_render
    return self.nodelist.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 990, in render
    bit = node.render_annotated(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 957, in render_annotated
    return self.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/loader_tags.py", line 72, in render
    result = block.nodelist.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 990, in render
    bit = node.render_annotated(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 957, in render_annotated
    return self.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/loader_tags.py", line 72, in render
    result = block.nodelist.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 990, in render
    bit = node.render_annotated(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 957, in render_annotated
    return self.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/loader_tags.py", line 72, in render
    result = block.nodelist.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 990, in render
    bit = node.render_annotated(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/base.py", line 957, in render_annotated
    return self.render(context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/library.py", line 203, in render
    output = self.func(*resolved_args, **resolved_kwargs)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/flatblocks/templatetags/flatblocks.py", line 92, in flatblock
    result = render_to_string(using, context)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/loader.py", line 68, in render_to_string
    return template.render(context, request)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/backends/django.py", line 64, in render
    context = make_context(context, request, autoescape=self.backend.engine.autoescape)
  File "/Users/phil/.pyenv/versions/django-hines/lib/python3.6/site-packages/django/template/context.py", line 287, in make_context
    raise TypeError('context must be a dict rather than %s.' % context.__class__.__name__)
TypeError: context must be a dict rather than RequestContext.

(I assume this is the currently authoritative django-flatblocks repo... it was a bit of a circuitous route to get here.)

Way to write a conditional for flatblocks?

I'm using this code in my template:

        <div class="row pb-4">
            <div class="col text-center">
                {% flatblock "adbanner.above-content" %}
            </div>
        </div>

Of course, if the flatblock content area is empty, I don't want/need the partent div.row and div.col surrounding it. Is there any way to do something like this:

{% if flatblock "adbanner.above-content" %}

Release Django 1.7 compatible version

I see that changes required for Django 1.7 compatibility are in place already. Are there any plans to make new PyPI release which includes these changes?

Fix RemovedInDjango40Warning

/usr/local/lib/python3.8/site-packages/flatblocks/models.py:12: RemovedInDjango40Warning: django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy().

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.