Code Monkey home page Code Monkey logo

Comments (3)

schwanksta avatar schwanksta commented on September 3, 2024

Agreed.

On Tuesday, June 17, 2014, Ben Welsh [email protected] wrote:

It would be nice if we didn't have to do all this
http://django-bakery.readthedocs.org/en/latest/buildablemodels.html#celery-task-queue-integration
every time we implement a Celery based deployment.


Reply to this email directly or view it on GitHub
#52.

-Ken Schwencke

from django-bakery.

palewire avatar palewire commented on September 3, 2024

Tell me what's wrong below.

  • Even if we abstract away the save override stuff we typically use, a user will need to specify the is_published boolean field that our system will use to test if an object has been published or unpublished.
  • My gut feeling is that you should have to opt in to the celery task system and it should not be on by default. That would mean we do not package celery with the setup.py and it would have to be installed with pip independently.
  • As for how you opt-in at the model level, I'm not sure but I think we have a couple options. There could be an optional boolean attribute you stick on the BuildableModel class we have now that would hook everything up. Or we could make child class on BuildableModel called AutomaticallyBuildableModel or BuildableModelWithTasks or something like that would have the extra attributes and tricks appended. Simply have your custom models inherit from that, specify your is_published field (and maybe we could have is_published as a sensible default) and it would hook in with the tasks right away.
  • We should make a new advanced usage section of the documentation that explains how to do this, once we've worked it out, as well as the JSON view stuff we ironed out recently
  • We should be able to come up with unit tests for the tasks by building some fake objects and verifying they exist (or don't) afterward.

from django-bakery.

palewire avatar palewire commented on September 3, 2024

I suppose the new model needs a delete() override as well? Something like:

    def delete(self, *args, **kwargs):
        # if obj.save(unpublish=False) has been passed, we skip the task.
        unpublish = kwargs.pop('unpublish', True)
        super(self.__class__, self).delete(*args, **kwargs)
        if not unpublish:
            pass
        else:
            tasks.unpublish.delay(self)

from django-bakery.

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.