Code Monkey home page Code Monkey logo

Comments (11)

ziima avatar ziima commented on May 27, 2024 1
  1. I can't imagine this to work for class based views.
  2. The list could be really long. In such case, the decorator would be much easier to maintain.

from django-maintenance-mode.

fabiocaccamo avatar fabiocaccamo commented on May 27, 2024

This is a very useful feature. Thanks for the suggestion, I will work on it as soon as possible.

from django-maintenance-mode.

ziima avatar ziima commented on May 27, 2024

If you don't insist on writing it yourself, I should be able to find time to do it next week.

from django-maintenance-mode.

fabiocaccamo avatar fabiocaccamo commented on May 27, 2024

If you can write it with tests it would be great.

By default all views are affected by maintenance-mode when active, so my idea is to add a single decorator named ignore_maintenance_mode.

from django-maintenance-mode.

ziima avatar ziima commented on May 27, 2024

That's only true if middleware is turned on. Some of our use cases requires only few views to be turned on, while most of the application is not affected by the middleware. My original idea was to add possitive decorator.

But I see you case, so I suggest to add both decorators - force and ignore, similarly to CSRF in Django itself.

from django-maintenance-mode.

fabiocaccamo avatar fabiocaccamo commented on May 27, 2024

So you need to have some views under a forced maintenance-mode also if the maintenance-mode is not set to True, is it correct?

from django-maintenance-mode.

ziima avatar ziima commented on May 27, 2024

Nope, we need only a few views to be subject of the maintenance mode, while most of them is not affected. Thus we want to decorate those views and avoid usage of the middleware.

from django-maintenance-mode.

fabiocaccamo avatar fabiocaccamo commented on May 27, 2024

By default all views are affected by maintenance-mode when active, so my idea is to add a single decorator named ignore_maintenance_mode (to avoid usage of the middleware for the views that must not be affected by maintenance-mode)

I think we are saying the same thing...

from django-maintenance-mode.

fabiocaccamo avatar fabiocaccamo commented on May 27, 2024

I think that the best approach would be add a new setting:

MAINTENANCE_MODE_IGNORE_VIEWS = ('app.views.no_maintenance_mode', )

Have you any reason to prefere a view decorator?

from django-maintenance-mode.

fabiocaccamo avatar fabiocaccamo commented on May 27, 2024

Released 0.9.0
Now you can use force_maintenance_mode_on and force_maintenance_mode_off decorators.

from django-maintenance-mode.

ziima avatar ziima commented on May 27, 2024

Thanks, but force_maintenance_mode_on seems somewhat ridiculous. It always enforces maintenance mode on a view, which I can't find any use for.

Instead such decorator should check maintenance mode, even if maintenance middleware is not active.

from django-maintenance-mode.

Related Issues (20)

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.