Giter VIP home page Giter VIP logo

roan's Introduction

Website do Cobrateam

roan's People

Contributors

fsouza avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

roan's Issues

Add on_delete

Add the on_delete method, to release the version 0.1 :)

The API should look like the on_save:

from models import Post
from roan import purge

purge("/posts").on_delete(Post)

Add support for purge urls on saving and deleting model instances

roan shall support purging URLs on save and delete model instances too.

Imagine you're using django.contrib.flatpages app and have the /about/contact/ page, it would nice to be able to purge only that page when you save or delete the instance /about/contact/, not any instance. Something like this:

from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
from roan import purge

flatpage = FlatPage.objects.get_or_create(url=u'/about/contact/', title=u'Contact')
flatpage.sites = (Site.objects.get_or_create(domain=u'example.com', name=u'example.com'),)

purge(flatpage.url).on_save(flatpage)
purge(flatpage.url).on_delete(flatpage)

The alternative today is to purge all flatpages URL on saving or deleting one of them:

from django.contrib.flatpages.models import FlatPage
from roan import purge

flatpages = FlatPage.objects.all()
for f in flatpages:
    purge(f.url).on_save(FlatPage)

And that's not nice :)

Add support for custom signals

Some people use custom signals, like post_published, that is dispatched whenever a post is published (it usually dispatches post_save with a Post instance too), but custom signals might be a good idea :)

Add some syntax sugar to the API

Some drafts:

from myapp.models import Comment, MenuItem, Post

purge('/').on_save(Post).or_save(Comment).or_delete(MenuItem)
purge('/posts').on_save_or_delete(Post)

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.