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

Missing context content with multiple inheritance #6

Closed
cfra opened this issue Nov 11, 2019 · 1 comment · Fixed by #7
Closed

Missing context content with multiple inheritance #6

cfra opened this issue Nov 11, 2019 · 1 comment · Fixed by #7
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@cfra
Copy link
Contributor

cfra commented Nov 11, 2019

Setup

I ran into this issue in a real live use-case, and created the following distilled version which allows to reproduce the issue:

from django_context_decorator import context
from django.views.generic import TemplateView

class BaseView(TemplateView):
    template_name = "example.html"

    @context
    @property
    def bg_image(self):
        return "BaseView.bg_image"

    @context
    @property
    def heading(self):
        return "BaseView.heading"

    @context
    @property
    def subheading(self):
        return "BaseView.subheading"


class MixinView:
    @context
    @property
    def bg_image(self):
        return "MixinView.bg_image"


class DescendantView(BaseView):
    @context
    @property
    def heading(self):
        return "DescendantView.heading"


class MixedView(MixinView, DescendantView):
    @context
    @property
    def subheading(self):
        return "MixedView.subheading"

Observed Behavior

When MixedView gets rendered, bg_image and subheading are set correctly in the context, but heading is missing completely.

Expected Behavior

heading should be present in the context with value DescendantView.heading.

@rixx
Copy link
Owner

rixx commented Nov 11, 2019

Definitely a bug – happy to take pull requests!

@rixx rixx added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Nov 11, 2019
@rixx rixx closed this as completed in #7 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants