Giter VIP home page Giter VIP logo

Comments (4)

hermanschaaf avatar hermanschaaf commented on June 9, 2024

Just to add my two cents; I only get this error when calling an actstream event from within a management command. For some reason, in this case, when actstream gets initialized, the models in the appcache are not yet properly loaded, and all references are just None.

I could find a way to fix this from within the actstream package, but my current workaround involves reloading the MODELS setting from within my management command:

class Command(NoArgsCommand):
    ...
    def command(self, **kwargs):
        import actstream.settings
        actstream.settings.MODELS = {}
        for model in getattr(settings, 'ACTSTREAM_ACTION_MODELS', ('auth.User',)):
             actstream.settings.MODELS[model.lower()] = model = get_model(*model.split('.'))
        ...

This solves the problem completely. Adding a function to the actstream code that does exactly the same thing, and calling the function, however, did not work. Strange behavior, if you ask me. Any thoughts on how we can fix this in the actstream code?

from django-activity-stream.

maximegaillard avatar maximegaillard commented on June 9, 2024

I've exactly the same problem...

from django-activity-stream.

justquick avatar justquick commented on June 9, 2024

fixed in v0.4.2

from django-activity-stream.

pcompassion avatar pcompassion commented on June 9, 2024

I use v0.4.5beta1 and have the same problem..

model not recognized when run from management command.

Actually out of my 4 models, 2 models are recognized and the other two are not.
And it works fine if run normally (not by management command)

from django-activity-stream.

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.