Giter Site home page Giter Site logo

Comments (4)

jezdez avatar jezdez commented on June 8, 2024

@typeshige Can you provide an example what didn't work for you? I've extended the tests to make sure this works (35271f7) and it seems to still pass: https://travis-ci.org/jezdez/django-configurations/builds/6652424

from django-configurations.

typeshige avatar typeshige commented on June 8, 2024

This didn't work for me:

ACCESS_FUNCTION = lamda user: user.is_staff

Thanks!

from django-configurations.

jezdez avatar jezdez commented on June 8, 2024

Aha! Now we're getting somewhere. The reason this doesn't work is that if you want to provide a setting that is a callable (e.g. a lambda) configurations will simply call it thinking it's a method or a static method of the settings class returning the setting. The user in your lambda would be the self of the settings class and would obviously not have a is_staff attribute.

This is an obvious limitation of django-configurations which I'm going to fix by introducing a pristine decorator in 0.3.

from django-configurations.

typeshige avatar typeshige commented on June 8, 2024

Thank you, this is awesome. I'm learning a lot as I see how you fix and update this app. I'm glad I started following this from the start before it got fully built-out!!

from django-configurations.

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.