AndrewIngram / django-extra-views

Django's class-based generic views are awesome, let's have more of them.
MIT License
1.39k stars 172 forks source link

Added messages support #147

Closed freeworlder closed 5 years ago

freeworlder commented 7 years ago

Issue #59

freeworlder commented 7 years ago

Checks are failing as there is not django contrib messages module found that is required for messages to work.

jcuotpc commented 7 years ago

Is there a way to get the context data from the InlineFormSet to customize the success message?

sdolemelipone commented 6 years ago

Hi @freeworlder, I have coded a change that will pass the middleware into the test environment and fix the tests. There should be a box to allow contributors to push updates to your PR, if you tick that I will push it.

sdolemelipone commented 6 years ago

Ah, I see that box is for maintainers only. In that case, here you go. This only works from Django 1.10 onwards as I think the name of the middleware module has changed. As the master branch is only supporting Django 1.11+ this won't be a problem.

runtests.py:

if not settings.configured:
    settings.configure(
        ...
        MIDDLEWARE=[
            'django.middleware.security.SecurityMiddleware',
            'django.contrib.sessions.middleware.SessionMiddleware',
            'django.middleware.common.CommonMiddleware',
            'django.middleware.csrf.CsrfViewMiddleware',
            'django.contrib.auth.middleware.AuthenticationMiddleware',
            'django.contrib.messages.middleware.MessageMiddleware',
            'django.middleware.clickjacking.XFrameOptionsMiddleware',
        ],
        ...

Then in extra_views_tests/tests.py find and replace res.context['request'] with res.context['view'].request (2 occurrences).

sdolemelipone commented 5 years ago

@jonashaag what is the best way to proceed here? I could create an entirely new PR with @freeworlder's code in it but would rather keep the commits as his if possible. If I resolve the conflicts in his master branch, will that cause all his tests to fail (due to the other changes made to the main master branch since he commited this)? I.e. will travis run against his master branch, or our master branch with his commits on top?

If you're not sure, I can just try resolving the conflicts and see what happens...

sdolemelipone commented 5 years ago

Also needs another commit to add documentation.

jonashaag commented 5 years ago

Travis tests against the commits applied to the merge target (so, the current master).

I don't think there's much value in keeping commit history accurate; if you want to recognise their contributions you may simply add their name to the commit message.